tech(sidekiq): use sidekiq by default, clean transition code

This commit is contained in:
mfo 2024-10-03 11:13:33 +02:00
parent dbb34d2b36
commit ab8ac78ccb
No known key found for this signature in database
GPG key ID: 7CE3E1F5B794A8EC
5 changed files with 5 additions and 51 deletions

View file

@ -1,3 +1,3 @@
web: RAILS_QUEUE_ADAPTER=delayed_job bin/rails server -p 3000
web: bin/rails server -p 3000
jobs: bin/rake jobs:work
vite: bin/vite dev

View file

@ -1,14 +0,0 @@
# frozen_string_literal: true
class SidekiqAgainJob < ApplicationJob
self.queue_adapter = :sidekiq
queue_as :default
def perform(user, with_exception: false)
if with_exception
raise 'Nop'
end
Sentry.capture_message('this is a message from sidekiq')
UserMailer.new_account_warning(user).deliver_now
end
end

View file

@ -282,3 +282,6 @@ VITE_LIGHTGALLERY_LICENSE_KEY = ""
# This email will be visible to users whom dossier had been fixed by our maintenance_tasks
# By default we use CONTACT_EMAIL, but you can customize it
MAINTENANCE_INSTRUCTEUR_EMAIL=""
# want to stay on delayed job ? set as 'delayed_job'
RAILS_QUEUE_ADAPTER="

View file

@ -83,7 +83,7 @@ Rails.application.configure do
end
# Use a real queuing backend for Active Job (and separate queues per environment).
config.active_job.queue_adapter = :delayed_job
config.active_job.queue_adapter = ENV.fetch('RAILS_QUEUE_ADAPTER') { :sidekiq }
# config.active_job.queue_name_prefix = "tps_production"
config.action_mailer.perform_caching = false

View file

@ -1,35 +0,0 @@
# frozen_string_literal: true
if Rails.env.production? && SIDEKIQ_ENABLED
ActiveSupport.on_load(:after_initialize) do
[
ActiveStorage::AnalyzeJob,
ActiveStorage::PurgeJob,
AdminUpdateDefaultZonesJob,
APIEntreprise::Job,
AdminUpdateDefaultZonesJob,
BatchOperationEnqueueAllJob,
BatchOperationProcessOneJob,
ChampFetchExternalDataJob,
Cron::CronJob,
DestroyRecordLaterJob,
DossierIndexSearchTermsJob,
DossierOperationLogMoveToColdStorageBatchJob,
DossierRebaseJob,
HelpscoutCreateConversationJob,
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