Sha256: b253f0ded938db8a2b18bafedcf6994dd6486925aa843393ed724a52fe2bad23

Contents?: true

Size: 722 Bytes

Versions: 7

Compression:

Stored size: 722 Bytes

Contents

require "active_job/queue_adapter"

class MissionControl::Jobs::Server
  include MissionControl::Jobs::IdentifiedByName
  include Serializable, RecurringTasks, Workers

  attr_reader :name, :queue_adapter, :application

  def initialize(name:, queue_adapter:, application:)
    super(name: name)
    @queue_adapter = queue_adapter
    @application = application
  end

  def activating(&block)
    previous_adapter = ActiveJob::Base.current_queue_adapter
    ActiveJob::Base.current_queue_adapter = queue_adapter
    queue_adapter.activating(&block)
  ensure
    ActiveJob::Base.current_queue_adapter = previous_adapter
  end

  def queue_adapter_name
    ActiveJob.adapter_name(queue_adapter).underscore.to_sym
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
mission_control-jobs-0.3.3 lib/mission_control/jobs/server.rb
mission_control-jobs-0.3.2 lib/mission_control/jobs/server.rb
mission_control-jobs-0.3.1 lib/mission_control/jobs/server.rb
mission_control-jobs-0.3.0 lib/mission_control/jobs/server.rb
mission_control-jobs-0.2.2 lib/mission_control/jobs/server.rb
mission_control-jobs-0.2.1 lib/mission_control/jobs/server.rb
mission_control-jobs-0.2.0 lib/mission_control/jobs/server.rb