diff --git a/app/jobs/cron/cron_job.rb b/app/jobs/cron/cron_job.rb index 2938024e0..e7f4c66e1 100644 --- a/app/jobs/cron/cron_job.rb +++ b/app/jobs/cron/cron_job.rb @@ -11,7 +11,7 @@ class Cron::CronJob < ApplicationJob remove if cron_expression_changed? if !scheduled? - if SIDEKIQ_ENABLED + if queue_adapter == :sidekiq Sidekiq::Cron::Job.create(name: name, cron: cron_expression, class: name) else set(cron: cron_expression).perform_later @@ -36,7 +36,7 @@ class Cron::CronJob < ApplicationJob end def enqueued_cron_job - if SIDEKIQ_ENABLED + if queue_adapter == :sidekiq sidekiq_cron_job else delayed_job diff --git a/config/initializers/transition_to_sidekiq.rb b/config/initializers/transition_to_sidekiq.rb index 3f9d33160..6dd570e85 100644 --- a/config/initializers/transition_to_sidekiq.rb +++ b/config/initializers/transition_to_sidekiq.rb @@ -53,5 +53,9 @@ if Rails.env.production? && SIDEKIQ_ENABLED class Migrations::BackfillStableIdJob self.queue_adapter = :sidekiq end + + class Cron::CronJob < ApplicationJob + self.queue_adapter = :sidekiq + end end end