diff options
author | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2014-09-22 14:33:29 -0300 |
---|---|---|
committer | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2014-09-22 14:33:29 -0300 |
commit | f4595e624babf939788ec07aa9497b1650c54c6c (patch) | |
tree | 80e214f4a3a92d14d8c7d4f5efc6bd0993e791ae /activejob/lib | |
parent | b61a2db8d07146518c89bbf49176b093771af6d4 (diff) | |
parent | 0b10565d962f92e3a60ca3e0bf0e0a933125d690 (diff) | |
download | rails-f4595e624babf939788ec07aa9497b1650c54c6c.tar.gz rails-f4595e624babf939788ec07aa9497b1650c54c6c.tar.bz2 rails-f4595e624babf939788ec07aa9497b1650c54c6c.zip |
Merge pull request #16963 from collectiveidea/activejob-dj
Cleaner queuing of jobs using Delayed Job
Conflicts:
activejob/lib/active_job/queue_adapters/delayed_job_adapter.rb
Diffstat (limited to 'activejob/lib')
-rw-r--r-- | activejob/lib/active_job/queue_adapters/delayed_job_adapter.rb | 12 |
1 files changed, 9 insertions, 3 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 370a1fc01f..4d27c4fff8 100644 --- a/activejob/lib/active_job/queue_adapters/delayed_job_adapter.rb +++ b/activejob/lib/active_job/queue_adapters/delayed_job_adapter.rb @@ -15,16 +15,22 @@ module ActiveJob class DelayedJobAdapter class << self def enqueue(job) #:nodoc: - JobWrapper.new.delay(queue: job.queue_name).perform(job.serialize) + Delayed::Job.enqueue(JobWrapper.new(job.serialize), queue: job.queue_name) end def enqueue_at(job, timestamp) #:nodoc: - JobWrapper.new.delay(queue: job.queue_name, run_at: Time.at(timestamp)).perform(job.serialize) + Delayed::Job.enqueue(JobWrapper.new(job.serialize), queue: job.queue_name, run_at: Time.at(timestamp)) end end class JobWrapper #:nodoc: - def perform(job_data) + attr_accessor :job_data + + def initialize(job_data) + @job_data = job_data + end + + def perform Base.execute(job_data) end end |