diff options
author | Rafael França <rafaelmfranca@gmail.com> | 2017-11-25 12:26:51 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-11-25 12:26:51 -0500 |
commit | 8bc9f51ce6eac38efb3f348c5a40fc8f107382f4 (patch) | |
tree | 09384b553c034d478b8dfdb7d9070874216983f3 | |
parent | f76ca450f5027a4fa578d939b35fe4f608f2423e (diff) | |
parent | b1fbb6688c9e7b1909ca3ab71691822fc32daf1c (diff) | |
download | rails-8bc9f51ce6eac38efb3f348c5a40fc8f107382f4.tar.gz rails-8bc9f51ce6eac38efb3f348c5a40fc8f107382f4.tar.bz2 rails-8bc9f51ce6eac38efb3f348c5a40fc8f107382f4.zip |
Merge pull request #30879 from toptal/add_better_logging_to_delayed_job
Improved logging of AJ's DelayedJob wrapper
-rw-r--r-- | activejob/lib/active_job/queue_adapters/delayed_job_adapter.rb | 4 | ||||
-rw-r--r-- | activejob/test/integration/queuing_test.rb | 7 |
2 files changed, 11 insertions, 0 deletions
diff --git a/activejob/lib/active_job/queue_adapters/delayed_job_adapter.rb b/activejob/lib/active_job/queue_adapters/delayed_job_adapter.rb index 1978179948..8eeef32b99 100644 --- a/activejob/lib/active_job/queue_adapters/delayed_job_adapter.rb +++ b/activejob/lib/active_job/queue_adapters/delayed_job_adapter.rb @@ -34,6 +34,10 @@ module ActiveJob @job_data = job_data end + def display_name + "#{job_data['job_class']} [#{job_data['job_id']}] from DelayedJob(#{job_data['queue_name']}) with arguments: #{job_data['arguments']}" + end + def perform Base.execute(job_data) end diff --git a/activejob/test/integration/queuing_test.rb b/activejob/test/integration/queuing_test.rb index 0d8aa336a6..32ef485c45 100644 --- a/activejob/test/integration/queuing_test.rb +++ b/activejob/test/integration/queuing_test.rb @@ -45,6 +45,13 @@ class QueuingTest < ActiveSupport::TestCase end end + test "should supply a wrapped class name to DelayedJob" do + skip unless adapter_is?(:delayed_job) + ::HelloJob.perform_later + job = Delayed::Job.first + assert_match(/HelloJob \[[0-9a-f-]+\] from DelayedJob\(default\) with arguments: \[\]/, job.name) + end + test "resque JobWrapper should have instance variable queue" do skip unless adapter_is?(:resque) job = ::HelloJob.set(wait: 5.seconds).perform_later |