Class: Debugbar::ActiveJobEventSubscriber
- Inherits:
-
Object
- Object
- Debugbar::ActiveJobEventSubscriber
- Defined in:
- lib/debugbar/subscribers/active_job.rb
Class Method Summary collapse
- .enqueue(event) ⇒ Object
-
.enqueue_at(event) ⇒ Object
subscribe_log_level :enqueue, :info # ???.
Class Method Details
.enqueue(event) ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/debugbar/subscribers/active_job.rb', line 8 def enqueue(event) return if Debugbar::Current.ignore? job = event.payload[:job] ex = event.payload[:exception_object] || job.enqueue_error logs = [] logs << if ex "Failed enqueuing #{job.class.name} to #{queue_name(event)}: #{ex.class} (#{ex.})" elsif event.payload[:aborted] "Failed enqueuing #{job.class.name} to #{queue_name(event)}, a before_enqueue callback halted the enqueuing execution." else "Enqueued #{job.class.name} (Job ID: #{job.job_id}) to #{queue_name(event)}" + args_info(job) end logs << log_enqueue_source Debugbar::Tracker.add_job({ id: job.job_id, class: job.class.name, queue: queue_name(event), args: job.arguments.map { |arg| format(arg) }, successfully_enqueued: job.successfully_enqueued?, scheduled_at: scheduled_at(job), logs: logs, }) end |
.enqueue_at(event) ⇒ Object
subscribe_log_level :enqueue, :info # ???
36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 |
# File 'lib/debugbar/subscribers/active_job.rb', line 36 def enqueue_at(event) return if Debugbar::Current.ignore? job = event.payload[:job] ex = event.payload[:exception_object] || job.enqueue_error logs = [] logs << if ex "Failed enqueuing #{job.class.name} to #{queue_name(event)}: #{ex.class} (#{ex.})" elsif event.payload[:aborted] "Failed enqueuing #{job.class.name} to #{queue_name(event)}, a before_enqueue callback halted the enqueuing execution." else "Enqueued #{job.class.name} (Job ID: #{job.job_id}) to #{queue_name(event)} at #{scheduled_at(job)}" + args_info(job) end logs << log_enqueue_source Debugbar::Tracker.add_job({ id: job.job_id, class: job.class.name, queue: queue_name(event), args: job.arguments.map { |arg| format(arg) }, successfully_enqueued: job.successfully_enqueued?, scheduled_at: scheduled_at(job), logs: logs, }) end |