mirror of https://github.com/rails/rails
Delegate ActiveJob::Base#queue_adapter to class
This commit is contained in:
parent
62cf3b278e
commit
efbab35929
|
@ -52,9 +52,9 @@ module ActiveJob
|
|||
|
||||
run_callbacks :enqueue do
|
||||
if scheduled_at
|
||||
self.class.queue_adapter.enqueue_at self, scheduled_at
|
||||
queue_adapter.enqueue_at self, scheduled_at
|
||||
else
|
||||
self.class.queue_adapter.enqueue self
|
||||
queue_adapter.enqueue self
|
||||
end
|
||||
|
||||
successfully_enqueued = true
|
||||
|
|
|
@ -18,7 +18,7 @@ module ActiveJob
|
|||
private
|
||||
def instrument(operation, payload = {}, &block)
|
||||
ActiveSupport::Notifications.instrument \
|
||||
"#{operation}.active_job", payload.merge(adapter: self.class.queue_adapter, job: self), &block
|
||||
"#{operation}.active_job", payload.merge(adapter: queue_adapter, job: self), &block
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -10,7 +10,10 @@ module ActiveJob
|
|||
|
||||
included do
|
||||
class_attribute :_queue_adapter_name, instance_accessor: false, instance_predicate: false
|
||||
class_attribute :_queue_adapter, instance_accessor: false, instance_predicate: false
|
||||
class_attribute :_queue_adapter, default: :async, instance_accessor: false, instance_predicate: false
|
||||
|
||||
delegate :queue_adapter, to: self
|
||||
|
||||
self.queue_adapter = :async
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in New Issue