aboutsummaryrefslogtreecommitdiffstats
path: root/lib/active_job
diff options
context:
space:
mode:
Diffstat (limited to 'lib/active_job')
-rw-r--r--lib/active_job/enqueuing.rb5
-rw-r--r--lib/active_job/log_subscriber.rb11
-rw-r--r--lib/active_job/queue_adapters/sidekiq_adapter.rb6
3 files changed, 14 insertions, 8 deletions
diff --git a/lib/active_job/enqueuing.rb b/lib/active_job/enqueuing.rb
index 46f703481a..6fb6f15ce2 100644
--- a/lib/active_job/enqueuing.rb
+++ b/lib/active_job/enqueuing.rb
@@ -11,8 +11,9 @@ module ActiveJob
# The return value is adapter-specific and may change in a future
# ActiveJob release.
def enqueue(*args)
- ActiveSupport::Notifications.instrument "enqueue.active_job", adapter: queue_adapter, job: self, params: args
- queue_adapter.queue self, *Parameters.serialize(args)
+ serialized_args = Parameters.serialize(args)
+ ActiveSupport::Notifications.instrument "enqueue.active_job", adapter: queue_adapter, job: self, args: serialized_args
+ queue_adapter.queue self, *serialized_args
end
end
end
diff --git a/lib/active_job/log_subscriber.rb b/lib/active_job/log_subscriber.rb
index 31c61a6068..472c9f3081 100644
--- a/lib/active_job/log_subscriber.rb
+++ b/lib/active_job/log_subscriber.rb
@@ -1,12 +1,13 @@
+require 'active_support/core_ext/string/filters'
+
module ActiveJob
class LogSubscriber < ActiveSupport::LogSubscriber
def enqueue(event)
- payload = event.payload
- params = payload[:params]
- adapter = payload[:adapter]
- job = payload[:job]
+ queue_name = event.payload[:adapter].name.demodulize.remove('Adapter')
+ job_name = event.payload[:job].name
+ args = event.payload[:args].any? ? ": #{event.payload[:args].inspect}" : ""
- info "ActiveJob enqueued to #{adapter.name.demodulize} job #{job.name}: #{params.inspect}"
+ info "Enqueued #{job_name} to #{queue_name}" + args
end
def logger
diff --git a/lib/active_job/queue_adapters/sidekiq_adapter.rb b/lib/active_job/queue_adapters/sidekiq_adapter.rb
index c8fac32963..43bd69790c 100644
--- a/lib/active_job/queue_adapters/sidekiq_adapter.rb
+++ b/lib/active_job/queue_adapters/sidekiq_adapter.rb
@@ -5,7 +5,11 @@ module ActiveJob
class SidekiqAdapter
class << self
def queue(job, *args)
- JobWrapper.client_push class: JobWrapper, queue: job.queue_name, args: [ job, *args ]
+ Sidekiq::Client.push \
+ 'class' => JobWrapper,
+ 'queue' => job.queue_name,
+ 'args' => [ job, *args ],
+ 'retry' => true
end
end