diff --git a/app/jobs/priorized_mail_delivery_job.rb b/app/jobs/priorized_mail_delivery_job.rb index db35c9bd5..2404e3912 100644 --- a/app/jobs/priorized_mail_delivery_job.rb +++ b/app/jobs/priorized_mail_delivery_job.rb @@ -12,7 +12,7 @@ class PriorizedMailDeliveryJob < ActionMailer::MailDeliveryJob end end - def custom_queue # should be low - ENV.fetch('BULK_EMAIL_QUEUE') { Rails.application.config.action_mailer.deliver_later_queue_name.to_s } + def custom_queue + 'low' end end diff --git a/config/application.rb b/config/application.rb index b57986388..dc185a729 100644 --- a/config/application.rb +++ b/config/application.rb @@ -53,14 +53,14 @@ module TPS config.action_dispatch.ip_spoofing_check = false # Set the queue name for the mail delivery jobs to 'mailers' - config.action_mailer.deliver_later_queue_name = 'mailers' + config.action_mailer.deliver_later_queue_name = 'critical' # otherwise, :low # Allow the error messages format to be customized config.active_model.i18n_customize_full_message = true # Set the queue name for the analysis jobs to 'active_storage_analysis' - config.active_storage.queues.analysis = :active_storage_analysis - config.active_storage.queues.purge = :purge + config.active_storage.queues.analysis = :default + config.active_storage.queues.purge = :low config.active_support.cache_format_version = 7.0 diff --git a/spec/mailers/administrateur_mailer_spec.rb b/spec/mailers/administrateur_mailer_spec.rb index c038975f2..180877eb1 100644 --- a/spec/mailers/administrateur_mailer_spec.rb +++ b/spec/mailers/administrateur_mailer_spec.rb @@ -11,8 +11,7 @@ RSpec.describe AdministrateurMailer, type: :mailer do it { expect(subject.subject).to include("La suppression automatique des dossiers a été activée sur la démarche") } context 'when perform_later is called' do - let(:custom_queue) { 'low_priority' } - before { ENV['BULK_EMAIL_QUEUE'] = custom_queue } + let(:custom_queue) { 'low' } it 'enqueues email is custom queue for low priority delivery' do expect { subject.deliver_later }.to have_enqueued_job.on_queue(custom_queue) end @@ -52,8 +51,7 @@ end it { expect(subject.body).to include("un de vos services n'a pas son siret renseigné") } context 'when perform_later is called' do - let(:custom_queue) { 'low_priority' } - before { ENV['BULK_EMAIL_QUEUE'] = custom_queue } + let(:custom_queue) { 'low' } it 'enqueues email is custom queue for low priority delivery' do expect { subject.deliver_later }.to have_enqueued_job.on_queue(custom_queue) end diff --git a/spec/mailers/instructeur_mailer_spec.rb b/spec/mailers/instructeur_mailer_spec.rb index db53e6282..28667228e 100644 --- a/spec/mailers/instructeur_mailer_spec.rb +++ b/spec/mailers/instructeur_mailer_spec.rb @@ -10,8 +10,7 @@ RSpec.describe InstructeurMailer, type: :mailer do it { expect(subject.body).to include('Bonjour') } context 'when perform_later is called' do - let(:custom_queue) { 'low_priority' } - before { ENV['BULK_EMAIL_QUEUE'] = custom_queue } + let(:custom_queue) { 'low' } it 'enqueues email is custom queue for low priority delivery' do expect { subject.deliver_later }.to have_enqueued_job(PriorizedMailDeliveryJob).on_queue(custom_queue) @@ -81,9 +80,7 @@ RSpec.describe InstructeurMailer, type: :mailer do end context 'when perform_later is called' do - let(:custom_queue) { 'low_priority' } - before { ENV['BULK_EMAIL_QUEUE'] = custom_queue } - + let(:custom_queue) { 'low' } it 'enqueues email is custom queue for low priority delivery' do expect { subject.deliver_later }.to have_enqueued_job.on_queue(custom_queue) end diff --git a/spec/mailers/user_mailer_spec.rb b/spec/mailers/user_mailer_spec.rb index c187c27d7..aa2b1812a 100644 --- a/spec/mailers/user_mailer_spec.rb +++ b/spec/mailers/user_mailer_spec.rb @@ -151,8 +151,7 @@ RSpec.describe UserMailer, type: :mailer do context 'when perform_later is called' do let(:role) { administrateurs(:default_admin) } - let(:custom_queue) { 'low_priority' } - before { ENV['BULK_EMAIL_QUEUE'] = custom_queue } + let(:custom_queue) { 'low' } it 'enqueues email is custom queue for low priority delivery' do expect { subject.deliver_later }.to have_enqueued_job.on_queue(custom_queue) end @@ -168,8 +167,7 @@ RSpec.describe UserMailer, type: :mailer do end context 'when perform_later is called' do - let(:custom_queue) { 'low_priority' } - before { ENV['BULK_EMAIL_QUEUE'] = custom_queue } + let(:custom_queue) { 'low' } it 'enqueues email is custom queue for low priority delivery' do expect { subject.deliver_later }.to have_enqueued_job.on_queue(custom_queue) end @@ -188,8 +186,7 @@ RSpec.describe UserMailer, type: :mailer do end context 'when perform_later is called' do - let(:custom_queue) { 'low_priority' } - before { ENV['BULK_EMAIL_QUEUE'] = custom_queue } + let(:custom_queue) { 'low' } it 'enqueues email is custom queue for low priority delivery' do expect { subject.deliver_later }.to have_enqueued_job.on_queue(custom_queue) end