fix(cron): really schedule jobs on sidekiq instead of running them

This commit is contained in:
Colin Darie 2024-04-10 18:02:17 +02:00
parent e1144cf655
commit dfbe53dcc5
No known key found for this signature in database
GPG key ID: 8C76CADD40253590

View file

@ -4,14 +4,14 @@ class Cron::CronJob < ApplicationJob
class << self
def schedulable?
true && ENV['CRON_JOBS_DISABLED'].blank?
ENV['CRON_JOBS_DISABLED'].blank?
end
def schedule
remove if cron_expression_changed?
if !scheduled?
if queue_adapter == :sidekiq
if queue_adapter_name == "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 queue_adapter == :sidekiq
if queue_adapter_name == "sidekiq"
sidekiq_cron_job
else
delayed_job