fix(jobs): don't enqueue crons to default adapter anymore

This commit is contained in:
Colin Darie 2024-04-08 18:27:20 +02:00
parent 37ae3142ff
commit 25892f594c
No known key found for this signature in database
GPG key ID: 8C76CADD40253590
2 changed files with 6 additions and 2 deletions

View file

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

View file

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