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
|
class ChampFetchExternalDataJob < ApplicationJob
|
||||||
discard_on ActiveJob::DeserializationError
|
discard_on ActiveJob::DeserializationError
|
||||||
|
queue_as :critical # ui feedback, asap
|
||||||
|
|
||||||
include Dry::Monads[:result]
|
include Dry::Monads[:result]
|
||||||
|
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
|
|
||||||
class DestroyRecordLaterJob < ApplicationJob
|
class DestroyRecordLaterJob < ApplicationJob
|
||||||
discard_on ActiveRecord::RecordNotFound
|
discard_on ActiveRecord::RecordNotFound
|
||||||
|
queue_as :low # destroy later, will be done when possible
|
||||||
|
|
||||||
def perform(record)
|
def perform(record)
|
||||||
record.destroy
|
record.destroy
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
class DolistReportJob < ApplicationJob
|
class DolistReportJob < ApplicationJob
|
||||||
# Consolidate random recent emails dispatched to Dolist with their statuses
|
# Consolidate random recent emails dispatched to Dolist with their statuses
|
||||||
# and send a report by email.
|
# and send a report by email.
|
||||||
|
queue_as :low # reporting will be done asap
|
||||||
def perform(report_to, sample_size = 1000)
|
def perform(report_to, sample_size = 1000)
|
||||||
events = EmailEvent.dolist.dispatched.where(processed_at: 2.weeks.ago..).order("RANDOM()").limit(sample_size)
|
events = EmailEvent.dolist.dispatched.where(processed_at: 2.weeks.ago..).order("RANDOM()").limit(sample_size)
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
class EtablissementUpdateJob < ApplicationJob
|
class EtablissementUpdateJob < ApplicationJob
|
||||||
|
queue_as :critical # reporting will be done asap, but no occurence found. maube dead?
|
||||||
def perform(dossier, siret)
|
def perform(dossier, siret)
|
||||||
begin
|
begin
|
||||||
etablissement_attributes = APIEntrepriseService.get_etablissement_params_for_siret(siret, dossier.procedure.id)
|
etablissement_attributes = APIEntrepriseService.get_etablissement_params_for_siret(siret, dossier.procedure.id)
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
class HelpscoutCreateConversationJob < ApplicationJob
|
class HelpscoutCreateConversationJob < ApplicationJob
|
||||||
|
queue_as :critical # user feedback is critical
|
||||||
class FileNotScannedYetError < StandardError
|
class FileNotScannedYetError < StandardError
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -12,7 +12,7 @@ class PriorizedMailDeliveryJob < ActionMailer::MailDeliveryJob
|
||||||
end
|
end
|
||||||
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 }
|
ENV.fetch('BULK_EMAIL_QUEUE') { Rails.application.config.action_mailer.deliver_later_queue_name.to_s }
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
class ProcessStalledDeclarativeDossierJob < ApplicationJob
|
class ProcessStalledDeclarativeDossierJob < ApplicationJob
|
||||||
|
queue_as :low
|
||||||
def perform(dossier)
|
def perform(dossier)
|
||||||
return if dossier.declarative_triggered_at.present?
|
return if dossier.declarative_triggered_at.present?
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
class ResetExpiringDossiersJob < ApplicationJob
|
class ResetExpiringDossiersJob < ApplicationJob
|
||||||
|
queue_as :low
|
||||||
def perform(procedure)
|
def perform(procedure)
|
||||||
procedure
|
procedure
|
||||||
.dossiers
|
.dossiers
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
class SendClosingNotificationJob < ApplicationJob
|
class SendClosingNotificationJob < ApplicationJob
|
||||||
|
queue_as :low # no rush on this one
|
||||||
|
|
||||||
def perform(user_ids, content, procedure)
|
def perform(user_ids, content, procedure)
|
||||||
User.where(id: user_ids).find_each do |user|
|
User.where(id: user_ids).find_each do |user|
|
||||||
Expired::MailRateLimiter.new().send_with_delay(UserMailer.notify_after_closing(user, content, @procedure))
|
Expired::MailRateLimiter.new().send_with_delay(UserMailer.notify_after_closing(user, content, @procedure))
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue