feat(async): re-order priority jobs
This commit is contained in:
parent
08ec45443d
commit
afe98704e9
9 changed files with 10 additions and 1 deletions
|
@ -2,6 +2,7 @@
|
|||
|
||||
class ChampFetchExternalDataJob < ApplicationJob
|
||||
discard_on ActiveJob::DeserializationError
|
||||
queue_as :critical # ui feedback, asap
|
||||
|
||||
include Dry::Monads[:result]
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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)
|
||||
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
class HelpscoutCreateConversationJob < ApplicationJob
|
||||
queue_as :critical # user feedback is critical
|
||||
class FileNotScannedYetError < StandardError
|
||||
end
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
class ProcessStalledDeclarativeDossierJob < ApplicationJob
|
||||
queue_as :low
|
||||
def perform(dossier)
|
||||
return if dossier.declarative_triggered_at.present?
|
||||
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
class ResetExpiringDossiersJob < ApplicationJob
|
||||
queue_as :low
|
||||
def perform(procedure)
|
||||
procedure
|
||||
.dossiers
|
||||
|
|
|
@ -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))
|
||||
|
|
Loading…
Reference in a new issue