1
0
Fork 0
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:
Rafael Mendonça França 2022-09-20 17:04:03 -04:00 committed by GitHub
commit a168949736
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 12 deletions

View file

@ -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

View file

@ -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: