feat(async): re-order priority jobs

This commit is contained in:
mfo 2024-09-24 21:24:22 +02:00
parent 08ec45443d
commit afe98704e9
No known key found for this signature in database
GPG key ID: 7CE3E1F5B794A8EC
9 changed files with 10 additions and 1 deletions

View file

@ -2,6 +2,7 @@
class ChampFetchExternalDataJob < ApplicationJob
discard_on ActiveJob::DeserializationError
queue_as :critical # ui feedback, asap
include Dry::Monads[:result]

View file

@ -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

View file

@ -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)

View file

@ -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)

View file

@ -1,6 +1,7 @@
# frozen_string_literal: true
class HelpscoutCreateConversationJob < ApplicationJob
queue_as :critical # user feedback is critical
class FileNotScannedYetError < StandardError
end

View file

@ -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

View file

@ -1,6 +1,7 @@
# frozen_string_literal: true
class ProcessStalledDeclarativeDossierJob < ApplicationJob
queue_as :low
def perform(dossier)
return if dossier.declarative_triggered_at.present?

View file

@ -1,6 +1,7 @@
# frozen_string_literal: true
class ResetExpiringDossiersJob < ApplicationJob
queue_as :low
def perform(procedure)
procedure
.dossiers

View file

@ -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))