mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Merge pull request #46080 from jdelStrother/sidekiq-activejob
Use a higher-level Sidekiq API for ActiveJob
This commit is contained in:
commit
a168949736
2 changed files with 12 additions and 12 deletions
|
@ -1,3 +1,7 @@
|
|||
* Add support for Sidekiq's transaction-aware client
|
||||
|
||||
*Jonathan del Strother*
|
||||
|
||||
* Remove QueAdapter from Active Job.
|
||||
|
||||
After maintaining Active Job QueAdapter by Rails and Que side
|
||||
|
|
|
@ -18,21 +18,17 @@ module ActiveJob
|
|||
# Rails.application.config.active_job.queue_adapter = :sidekiq
|
||||
class SidekiqAdapter
|
||||
def enqueue(job) # :nodoc:
|
||||
# Sidekiq::Client does not support symbols as keys
|
||||
job.provider_job_id = Sidekiq::Client.push \
|
||||
"class" => JobWrapper,
|
||||
"wrapped" => job.class,
|
||||
"queue" => job.queue_name,
|
||||
"args" => [ job.serialize ]
|
||||
job.provider_job_id = JobWrapper.set(
|
||||
wrapped: job.class,
|
||||
queue: job.queue_name
|
||||
).perform_async(job.serialize)
|
||||
end
|
||||
|
||||
def enqueue_at(job, timestamp) # :nodoc:
|
||||
job.provider_job_id = Sidekiq::Client.push \
|
||||
"class" => JobWrapper,
|
||||
"wrapped" => job.class,
|
||||
"queue" => job.queue_name,
|
||||
"args" => [ job.serialize ],
|
||||
"at" => timestamp
|
||||
job.provider_job_id = JobWrapper.set(
|
||||
wrapped: job.class,
|
||||
queue: job.queue_name,
|
||||
).perform_at(timestamp, job.serialize)
|
||||
end
|
||||
|
||||
class JobWrapper # :nodoc:
|
||||
|
|
Loading…
Reference in a new issue