From ae5937b22afaf6e2f85a8610141198098c6eeb6f Mon Sep 17 00:00:00 2001 From: Colin Darie Date: Wed, 12 Jun 2024 16:44:46 +0200 Subject: [PATCH] chore(sidekiq): concise transition and avoid typos by not (re)opening classes --- config/initializers/transition_to_sidekiq.rb | 121 +++++-------------- 1 file changed, 27 insertions(+), 94 deletions(-) diff --git a/config/initializers/transition_to_sidekiq.rb b/config/initializers/transition_to_sidekiq.rb index 3b5360b6a..bfc07449b 100644 --- a/config/initializers/transition_to_sidekiq.rb +++ b/config/initializers/transition_to_sidekiq.rb @@ -1,99 +1,32 @@ if Rails.env.production? && SIDEKIQ_ENABLED ActiveSupport.on_load(:after_initialize) do - class ActiveStorage::PurgeJob < ActiveStorage::BaseJob - self.queue_adapter = :sidekiq - end - - class ActiveStorage::AnalyzeJob < ActiveStorage::BaseJob - self.queue_adapter = :sidekiq - end - - class VirusScannerJob - self.queue_adapter = :sidekiq - end - - class DossierRebaseJob < ApplicationJob - self.queue_adapter = :sidekiq - end - - class ProcedureExternalURLCheckJob < ApplicationJob - self.queue_adapter = :sidekiq - end - - class MaintenanceTasks::TaskJob - self.queue_adapter = :sidekiq - end - - class PriorizedMailDeliveryJob < ActionMailer::MailDeliveryJob - self.queue_adapter = :sidekiq - end - - class ProcedureSVASVRProcessDossierJob < ApplicationJob - self.queue_adapter = :sidekiq - end - - class WebHookJob < ApplicationJob - self.queue_adapter = :sidekiq - end - - class DestroyRecordLaterJob < ApplicationJob - self.queue_adapter = :sidekiq - end - - class ChampFetchExternalDataJob < ApplicationJob - self.queue_adapter = :sidekiq - end - - class DossierIndexSearchTermsJob < ApplicationJob - self.queue_adapter = :sidekiq - end - - class Migrations::BackfillStableIdJob - self.queue_adapter = :sidekiq - end - - class Cron::CronJob < ApplicationJob - self.queue_adapter = :sidekiq - end - - class APIEntreprise::Job < ApplicationJob - self.queue_adapter = :sidekiq - end - - class DossierOperationLogMoveToColdStorageBatchJob < ApplicationJob - self.queue_adapter = :sidekiq - end - - class BatchOperationEnqueueAllJob < ApplicationJob - self.queue_adapter = :sidekiq - end - - class BatchOperationProcessOneJob < ApplicationJob - self.queue_adapter = :sidekiq - end - - class TitreIdentiteWatermarkJob < ApplicationJob - self.queue_adapter = :sidekiq - end - - class AdminUpdateDefaultZonesJob < ApplicationJob - self.queue_adapter = :sidekiq - end - - class ProcessStalledDeclarativeDossierJob < ApplicationJob - self.queue_adapter = :sidekiq - end - - class ResetExpiringDossiersJob < ApplicationJob - self.queue_adapter = :sidekiq - end - - class SendClosingNotificationJob < ApplicationJob - self.queue_adapter = :sidekiq - end - - class ImageProcessorJob < ApplicationJob - self.queue_adapter = :sidekiq + [ + ActiveStorage::AnalyzeJob, + ActiveStorage::PurgeJob, + AdminUpdateDefaultZonesJob, + APIEntreprise::Job, + AdminUpdateDefaultZonesJob, + BatchOperationEnqueueAllJob, + BatchOperationProcessOneJob, + ChampFetchExternalDataJob, + Cron::CronJob, + DestroyRecordLaterJob, + DossierIndexSearchTermsJob, + DossierOperationLogMoveToColdStorageBatchJob, + DossierRebaseJob, + ImageProcessorJob, + MaintenanceTasks::TaskJob, + Migrations::BackfillStableIdJob, + PriorizedMailDeliveryJob, + ProcedureExternalURLCheckJob, + ProcedureSVASVRProcessDossierJob, + ProcessStalledDeclarativeDossierJob, + ResetExpiringDossiersJob, + SendClosingNotificationJob, + VirusScannerJob, + WebHookJob + ].each do |job_class| + job_class.queue_adapter = :sidekiq end end end