Skip to content

Commit a168949

Browse files
authored
Merge pull request rails#46080 from jdelStrother/sidekiq-activejob
Use a higher-level Sidekiq API for ActiveJob
2 parents 43a9593 + b389920 commit a168949

File tree

2 files changed

+12
-12
lines changed

2 files changed

+12
-12
lines changed

activejob/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
* Add support for Sidekiq's transaction-aware client
2+
3+
*Jonathan del Strother*
4+
15
* Remove QueAdapter from Active Job.
26

37
After maintaining Active Job QueAdapter by Rails and Que side

activejob/lib/active_job/queue_adapters/sidekiq_adapter.rb

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -18,21 +18,17 @@ module QueueAdapters
1818
# Rails.application.config.active_job.queue_adapter = :sidekiq
1919
class SidekiqAdapter
2020
def enqueue(job) # :nodoc:
21-
# Sidekiq::Client does not support symbols as keys
22-
job.provider_job_id = Sidekiq::Client.push \
23-
"class" => JobWrapper,
24-
"wrapped" => job.class,
25-
"queue" => job.queue_name,
26-
"args" => [ job.serialize ]
21+
job.provider_job_id = JobWrapper.set(
22+
wrapped: job.class,
23+
queue: job.queue_name
24+
).perform_async(job.serialize)
2725
end
2826

2927
def enqueue_at(job, timestamp) # :nodoc:
30-
job.provider_job_id = Sidekiq::Client.push \
31-
"class" => JobWrapper,
32-
"wrapped" => job.class,
33-
"queue" => job.queue_name,
34-
"args" => [ job.serialize ],
35-
"at" => timestamp
28+
job.provider_job_id = JobWrapper.set(
29+
wrapped: job.class,
30+
queue: job.queue_name,
31+
).perform_at(timestamp, job.serialize)
3632
end
3733

3834
class JobWrapper # :nodoc:

0 commit comments

Comments
 (0)