diff options
Diffstat (limited to 'activejob/lib')
15 files changed, 24 insertions, 19 deletions
diff --git a/activejob/lib/active_job/callbacks.rb b/activejob/lib/active_job/callbacks.rb index af92031bc9..8901fa77f2 100644 --- a/activejob/lib/active_job/callbacks.rb +++ b/activejob/lib/active_job/callbacks.rb @@ -3,7 +3,7 @@ require 'active_support/callbacks' module ActiveJob # = Active Job Callbacks # - # Active Job provides hooks during the lifecycle of a job. Callbacks allows you to trigger + # Active Job provides hooks during the lifecycle of a job. Callbacks allow you to trigger # logic during the lifecycle of a job. Available callbacks: # # * <tt>before_enqueue</tt> diff --git a/activejob/lib/active_job/gem_version.rb b/activejob/lib/active_job/gem_version.rb index c166020b28..2545e09845 100644 --- a/activejob/lib/active_job/gem_version.rb +++ b/activejob/lib/active_job/gem_version.rb @@ -1,5 +1,5 @@ module ActiveJob - # Returns the version of the currently loaded ActiveJob as a <tt>Gem::Version</tt> + # Returns the version of the currently loaded Active Job as a <tt>Gem::Version</tt> def self.gem_version Gem::Version.new VERSION::STRING end diff --git a/activejob/lib/active_job/logging.rb b/activejob/lib/active_job/logging.rb index d9e544acf5..ae098a80f3 100644 --- a/activejob/lib/active_job/logging.rb +++ b/activejob/lib/active_job/logging.rb @@ -52,19 +52,19 @@ module ActiveJob class LogSubscriber < ActiveSupport::LogSubscriber def enqueue(event) - info "Enqueued #{event.payload[:job].name} (Job ID: #{event.payload[:job_id]}) to #{queue_name(event)}" + args_info(event) + info { "Enqueued #{event.payload[:job].name} (Job ID: #{event.payload[:job_id]}) to #{queue_name(event)}" + args_info(event) } end def enqueue_at(event) - info "Enqueued #{event.payload[:job].name} (Job ID: #{event.payload[:job_id]}) to #{queue_name(event)} at #{enqueued_at(event)}" + args_info(event) + info { "Enqueued #{event.payload[:job].name} (Job ID: #{event.payload[:job_id]}) to #{queue_name(event)} at #{enqueued_at(event)}" + args_info(event) } end def perform_start(event) - info "Performing #{event.payload[:job].name} from #{queue_name(event)}" + args_info(event) + info { "Performing #{event.payload[:job].name} from #{queue_name(event)}" + args_info(event) } end def perform(event) - info "Performed #{event.payload[:job].name} from #{queue_name(event)} in #{event.duration.round(2).to_s}ms" + info { "Performed #{event.payload[:job].name} from #{queue_name(event)} in #{event.duration.round(2).to_s}ms" } end private diff --git a/activejob/lib/active_job/queue_adapters/backburner_adapter.rb b/activejob/lib/active_job/queue_adapters/backburner_adapter.rb index 7a6032e56b..6fe2d4eb53 100644 --- a/activejob/lib/active_job/queue_adapters/backburner_adapter.rb +++ b/activejob/lib/active_job/queue_adapters/backburner_adapter.rb @@ -16,7 +16,7 @@ module ActiveJob class JobWrapper class << self def perform(job_name, *args) - job_name.constantize.new.execute *args + job_name.constantize.new.execute(*args) end end end 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 bfeaa836d2..a00569833a 100644 --- a/activejob/lib/active_job/queue_adapters/delayed_job_adapter.rb +++ b/activejob/lib/active_job/queue_adapters/delayed_job_adapter.rb @@ -15,7 +15,7 @@ module ActiveJob class JobWrapper def perform(job, *args) - job.new.execute *args + job.new.execute(*args) end end end diff --git a/activejob/lib/active_job/queue_adapters/inline_adapter.rb b/activejob/lib/active_job/queue_adapters/inline_adapter.rb index 50d14a321d..5805340fb0 100644 --- a/activejob/lib/active_job/queue_adapters/inline_adapter.rb +++ b/activejob/lib/active_job/queue_adapters/inline_adapter.rb @@ -3,7 +3,7 @@ module ActiveJob class InlineAdapter class << self def enqueue(job, *args) - job.new.execute *args + job.new.execute(*args) end def enqueue_at(*) diff --git a/activejob/lib/active_job/queue_adapters/qu_adapter.rb b/activejob/lib/active_job/queue_adapters/qu_adapter.rb index cdf4ae4ce9..5cb741c094 100644 --- a/activejob/lib/active_job/queue_adapters/qu_adapter.rb +++ b/activejob/lib/active_job/queue_adapters/qu_adapter.rb @@ -22,7 +22,7 @@ module ActiveJob end def perform - @job.new.execute *@args + @job.new.execute(*@args) end end end diff --git a/activejob/lib/active_job/queue_adapters/que_adapter.rb b/activejob/lib/active_job/queue_adapters/que_adapter.rb index 15a607bcb6..0b87deb4e0 100644 --- a/activejob/lib/active_job/queue_adapters/que_adapter.rb +++ b/activejob/lib/active_job/queue_adapters/que_adapter.rb @@ -15,7 +15,7 @@ module ActiveJob class JobWrapper < Que::Job def run(job_name, *args) - job_name.constantize.new.execute *args + job_name.constantize.new.execute(*args) end end end diff --git a/activejob/lib/active_job/queue_adapters/queue_classic_adapter.rb b/activejob/lib/active_job/queue_adapters/queue_classic_adapter.rb index c61e0e30db..d74f8cf90e 100644 --- a/activejob/lib/active_job/queue_adapters/queue_classic_adapter.rb +++ b/activejob/lib/active_job/queue_adapters/queue_classic_adapter.rb @@ -14,8 +14,10 @@ module ActiveJob end class JobWrapper - def self.perform(job_name, *args) - job_name.constantize.new.execute *args + class << self + def perform(job_name, *args) + job_name.constantize.new.execute(*args) + end end end end diff --git a/activejob/lib/active_job/queue_adapters/resque_adapter.rb b/activejob/lib/active_job/queue_adapters/resque_adapter.rb index 384aa0c4cc..da8212fc9b 100644 --- a/activejob/lib/active_job/queue_adapters/resque_adapter.rb +++ b/activejob/lib/active_job/queue_adapters/resque_adapter.rb @@ -32,7 +32,7 @@ module ActiveJob class JobWrapper class << self def perform(job_name, *args) - job_name.constantize.new.execute *args + job_name.constantize.new.execute(*args) end end end diff --git a/activejob/lib/active_job/queue_adapters/sidekiq_adapter.rb b/activejob/lib/active_job/queue_adapters/sidekiq_adapter.rb index f738a7d91c..3e20bec44c 100644 --- a/activejob/lib/active_job/queue_adapters/sidekiq_adapter.rb +++ b/activejob/lib/active_job/queue_adapters/sidekiq_adapter.rb @@ -27,7 +27,7 @@ module ActiveJob include Sidekiq::Worker def perform(job_name, *args) - job_name.constantize.new.execute *args + job_name.constantize.new.execute(*args) end end end diff --git a/activejob/lib/active_job/queue_adapters/sneakers_adapter.rb b/activejob/lib/active_job/queue_adapters/sneakers_adapter.rb index 051a8c3bd7..48b3df6a46 100644 --- a/activejob/lib/active_job/queue_adapters/sneakers_adapter.rb +++ b/activejob/lib/active_job/queue_adapters/sneakers_adapter.rb @@ -25,7 +25,7 @@ module ActiveJob def work(msg) job_name, *args = ActiveSupport::JSON.decode(msg) - job_name.constantize.new.execute *args + job_name.constantize.new.execute(*args) ack! end end diff --git a/activejob/lib/active_job/queue_adapters/sucker_punch_adapter.rb b/activejob/lib/active_job/queue_adapters/sucker_punch_adapter.rb index 64b9c3ca15..16f05744f3 100644 --- a/activejob/lib/active_job/queue_adapters/sucker_punch_adapter.rb +++ b/activejob/lib/active_job/queue_adapters/sucker_punch_adapter.rb @@ -17,7 +17,7 @@ module ActiveJob include SuckerPunch::Job def perform(job, *args) - job.new.execute *args + job.new.execute(*args) end end end diff --git a/activejob/lib/active_job/queue_name.rb b/activejob/lib/active_job/queue_name.rb index c2186d9fe9..9698835b6e 100644 --- a/activejob/lib/active_job/queue_name.rb +++ b/activejob/lib/active_job/queue_name.rb @@ -3,10 +3,13 @@ module ActiveJob extend ActiveSupport::Concern module ClassMethods + mattr_accessor(:queue_name_prefix) mattr_accessor(:default_queue_name) { "default" } def queue_as(part_name) - self.queue_name = part_name.to_s.presence || default_queue_name + queue_name = part_name.to_s.presence || default_queue_name + name_parts = [queue_name_prefix.presence, queue_name] + self.queue_name = name_parts.compact.join('_') end end diff --git a/activejob/lib/active_job/version.rb b/activejob/lib/active_job/version.rb index 7e646fa3c4..971ba9fe0c 100644 --- a/activejob/lib/active_job/version.rb +++ b/activejob/lib/active_job/version.rb @@ -1,7 +1,7 @@ require_relative 'gem_version' module ActiveJob - # Returns the version of the currently loaded ActiveJob as a <tt>Gem::Version</tt> + # Returns the version of the currently loaded Active Job as a <tt>Gem::Version</tt> def self.version gem_version end |