diff options
author | Yves Senn <yves.senn@gmail.com> | 2015-08-13 09:56:06 +0200 |
---|---|---|
committer | Yves Senn <yves.senn@gmail.com> | 2015-08-13 10:00:19 +0200 |
commit | 68e3279163d06e6b04e043f91c9470e9259bbbe0 (patch) | |
tree | 0b332df5e991a64bea49e89b6d27f42c07f6111d /activejob/lib/active_job/queue_adapters | |
parent | 0650d0848817bbc71d1450297b066445e8433ff1 (diff) | |
download | rails-68e3279163d06e6b04e043f91c9470e9259bbbe0.tar.gz rails-68e3279163d06e6b04e043f91c9470e9259bbbe0.tar.bz2 rails-68e3279163d06e6b04e043f91c9470e9259bbbe0.zip |
implement `provider_job_id` for `queue_classic`.
The latest, currently unreleased, version of queue_classic is required
for this to work. See
https://github.com/QueueClassic/queue_classic/pull/262 for more details.
Diffstat (limited to 'activejob/lib/active_job/queue_adapters')
-rw-r--r-- | activejob/lib/active_job/queue_adapters/queue_classic_adapter.rb | 8 |
1 files changed, 6 insertions, 2 deletions
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 059754a87f..0ee41407d8 100644 --- a/activejob/lib/active_job/queue_adapters/queue_classic_adapter.rb +++ b/activejob/lib/active_job/queue_adapters/queue_classic_adapter.rb @@ -18,7 +18,9 @@ module ActiveJob # Rails.application.config.active_job.queue_adapter = :queue_classic class QueueClassicAdapter def enqueue(job) #:nodoc: - build_queue(job.queue_name).enqueue("#{JobWrapper.name}.perform", job.serialize) + qc_job = build_queue(job.queue_name).enqueue("#{JobWrapper.name}.perform", job.serialize) + job.provider_job_id = qc_job["id"] if qc_job.is_a?(Hash) + qc_job end def enqueue_at(job, timestamp) #:nodoc: @@ -28,7 +30,9 @@ module ActiveJob 'the QC::Queue needs to respond to `enqueue_at(timestamp, method, *args)`. ' \ 'You can implement this yourself or you can use the queue_classic-later gem.' end - queue.enqueue_at(timestamp, "#{JobWrapper.name}.perform", job.serialize) + qc_job = queue.enqueue_at(timestamp, "#{JobWrapper.name}.perform", job.serialize) + job.provider_job_id = qc_job["id"] if qc_job.is_a?(Hash) + qc_job end # Builds a <tt>QC::Queue</tt> object to schedule jobs on. |