fix(jobs): don't enqueue crons to default adapter anymore
This commit is contained in:
parent
37ae3142ff
commit
25892f594c
2 changed files with 6 additions and 2 deletions
|
@ -11,7 +11,7 @@ class Cron::CronJob < ApplicationJob
|
||||||
remove if cron_expression_changed?
|
remove if cron_expression_changed?
|
||||||
|
|
||||||
if !scheduled?
|
if !scheduled?
|
||||||
if SIDEKIQ_ENABLED
|
if queue_adapter == :sidekiq
|
||||||
Sidekiq::Cron::Job.create(name: name, cron: cron_expression, class: name)
|
Sidekiq::Cron::Job.create(name: name, cron: cron_expression, class: name)
|
||||||
else
|
else
|
||||||
set(cron: cron_expression).perform_later
|
set(cron: cron_expression).perform_later
|
||||||
|
@ -36,7 +36,7 @@ class Cron::CronJob < ApplicationJob
|
||||||
end
|
end
|
||||||
|
|
||||||
def enqueued_cron_job
|
def enqueued_cron_job
|
||||||
if SIDEKIQ_ENABLED
|
if queue_adapter == :sidekiq
|
||||||
sidekiq_cron_job
|
sidekiq_cron_job
|
||||||
else
|
else
|
||||||
delayed_job
|
delayed_job
|
||||||
|
|
|
@ -53,5 +53,9 @@ if Rails.env.production? && SIDEKIQ_ENABLED
|
||||||
class Migrations::BackfillStableIdJob
|
class Migrations::BackfillStableIdJob
|
||||||
self.queue_adapter = :sidekiq
|
self.queue_adapter = :sidekiq
|
||||||
end
|
end
|
||||||
|
|
||||||
|
class Cron::CronJob < ApplicationJob
|
||||||
|
self.queue_adapter = :sidekiq
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue