diff --git a/app/jobs/champ_fetch_external_data_job.rb b/app/jobs/champ_fetch_external_data_job.rb index 99cd96a6e..134d579e0 100644 --- a/app/jobs/champ_fetch_external_data_job.rb +++ b/app/jobs/champ_fetch_external_data_job.rb @@ -2,6 +2,7 @@ class ChampFetchExternalDataJob < ApplicationJob discard_on ActiveJob::DeserializationError + queue_as :critical # ui feedback, asap include Dry::Monads[:result] diff --git a/app/jobs/destroy_record_later_job.rb b/app/jobs/destroy_record_later_job.rb index 8b39e11ac..426c967a7 100644 --- a/app/jobs/destroy_record_later_job.rb +++ b/app/jobs/destroy_record_later_job.rb @@ -2,6 +2,7 @@ class DestroyRecordLaterJob < ApplicationJob discard_on ActiveRecord::RecordNotFound + queue_as :low # destroy later, will be done when possible def perform(record) record.destroy diff --git a/app/jobs/dolist_report_job.rb b/app/jobs/dolist_report_job.rb index a27348270..60e1be5bf 100644 --- a/app/jobs/dolist_report_job.rb +++ b/app/jobs/dolist_report_job.rb @@ -3,6 +3,7 @@ class DolistReportJob < ApplicationJob # Consolidate random recent emails dispatched to Dolist with their statuses # and send a report by email. + queue_as :low # reporting will be done asap def perform(report_to, sample_size = 1000) events = EmailEvent.dolist.dispatched.where(processed_at: 2.weeks.ago..).order("RANDOM()").limit(sample_size) diff --git a/app/jobs/etablissement_update_job.rb b/app/jobs/etablissement_update_job.rb index cff98d98e..f5eaacba0 100644 --- a/app/jobs/etablissement_update_job.rb +++ b/app/jobs/etablissement_update_job.rb @@ -1,6 +1,7 @@ # frozen_string_literal: true class EtablissementUpdateJob < ApplicationJob + queue_as :critical # reporting will be done asap, but no occurence found. maube dead? def perform(dossier, siret) begin etablissement_attributes = APIEntrepriseService.get_etablissement_params_for_siret(siret, dossier.procedure.id) diff --git a/app/jobs/helpscout_create_conversation_job.rb b/app/jobs/helpscout_create_conversation_job.rb index 61b55bcaa..f18781d53 100644 --- a/app/jobs/helpscout_create_conversation_job.rb +++ b/app/jobs/helpscout_create_conversation_job.rb @@ -1,6 +1,7 @@ # frozen_string_literal: true class HelpscoutCreateConversationJob < ApplicationJob + queue_as :critical # user feedback is critical class FileNotScannedYetError < StandardError end diff --git a/app/jobs/priorized_mail_delivery_job.rb b/app/jobs/priorized_mail_delivery_job.rb index ac308b180..db35c9bd5 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 + def custom_queue # should be low ENV.fetch('BULK_EMAIL_QUEUE') { Rails.application.config.action_mailer.deliver_later_queue_name.to_s } end end diff --git a/app/jobs/process_stalled_declarative_dossier_job.rb b/app/jobs/process_stalled_declarative_dossier_job.rb index 6449c73af..aaa49fb70 100644 --- a/app/jobs/process_stalled_declarative_dossier_job.rb +++ b/app/jobs/process_stalled_declarative_dossier_job.rb @@ -1,6 +1,7 @@ # frozen_string_literal: true class ProcessStalledDeclarativeDossierJob < ApplicationJob + queue_as :low def perform(dossier) return if dossier.declarative_triggered_at.present? diff --git a/app/jobs/reset_expiring_dossiers_job.rb b/app/jobs/reset_expiring_dossiers_job.rb index 5cf818ee1..95a87f571 100644 --- a/app/jobs/reset_expiring_dossiers_job.rb +++ b/app/jobs/reset_expiring_dossiers_job.rb @@ -1,6 +1,7 @@ # frozen_string_literal: true class ResetExpiringDossiersJob < ApplicationJob + queue_as :low def perform(procedure) procedure .dossiers diff --git a/app/jobs/send_closing_notification_job.rb b/app/jobs/send_closing_notification_job.rb index f5d9f7167..f4850b870 100644 --- a/app/jobs/send_closing_notification_job.rb +++ b/app/jobs/send_closing_notification_job.rb @@ -1,6 +1,8 @@ # frozen_string_literal: true class SendClosingNotificationJob < ApplicationJob + queue_as :low # no rush on this one + def perform(user_ids, content, procedure) User.where(id: user_ids).find_each do |user| Expired::MailRateLimiter.new().send_with_delay(UserMailer.notify_after_closing(user, content, @procedure))