fix: remove bulk_auto_assignment_job cron schedule (#13877)

This commit is contained in:
Tanmay Deep Sharma
2026-03-31 10:56:59 +05:30
committed by GitHub
parent 0012fa2c35
commit 1987ac3d97
4 changed files with 14 additions and 151 deletions

View File

@@ -34,7 +34,18 @@ end
# https://github.com/ondrejbartas/sidekiq-cron
Rails.application.reloader.to_prepare do
# TODO: Switch to `load_from_hash!(..., source: 'schedule')` once we have a
# safe cleanup path for YAML-backed cron jobs already persisted in Redis.
Sidekiq::Cron::Job.load_from_hash YAML.load_file(schedule_file) if File.exist?(schedule_file) && Sidekiq.server?
# load_from_hash! upserts jobs from the YAML and removes any Redis-persisted
# jobs that share the same source tag but are no longer in the file.
# This ensures deleted schedule entries are cleaned up on deploy.
if File.exist?(schedule_file) && Sidekiq.server?
schedule = YAML.load_file(schedule_file)
# Cron entries removed from schedule.yml but possibly still in Redis
# with source:'dynamic' (predating the source tag). load_from_hash!
# only cleans up source:'schedule' entries, so these need explicit removal.
# Remove names from this list once they've been through a deploy cycle.
%w[bulk_auto_assignment_job].each { |name| Sidekiq::Cron::Job.destroy(name) }
Sidekiq::Cron::Job.load_from_hash!(schedule, source: 'schedule')
end
end