Merge pull request #10448 from colinux/increase-search-debounce-delay
Tech: limite l'engorgement des DossierIndexSearchTermsJob
This commit is contained in:
commit
8431771a61
3 changed files with 4 additions and 2 deletions
|
@ -1,4 +1,6 @@
|
||||||
class DossierIndexSearchTermsJob < ApplicationJob
|
class DossierIndexSearchTermsJob < ApplicationJob
|
||||||
|
queue_as :low_priority
|
||||||
|
|
||||||
discard_on ActiveRecord::RecordNotFound
|
discard_on ActiveRecord::RecordNotFound
|
||||||
|
|
||||||
def perform(dossier)
|
def perform(dossier)
|
||||||
|
|
|
@ -6,7 +6,7 @@ module DossierSearchableConcern
|
||||||
included do
|
included do
|
||||||
after_commit :index_search_terms_later, if: -> { previously_new_record? || user_previously_changed? || mandataire_first_name_previously_changed? || mandataire_last_name_previously_changed? }
|
after_commit :index_search_terms_later, if: -> { previously_new_record? || user_previously_changed? || mandataire_first_name_previously_changed? || mandataire_last_name_previously_changed? }
|
||||||
|
|
||||||
SEARCH_TERMS_DEBOUNCE = 30.seconds
|
SEARCH_TERMS_DEBOUNCE = 5.minutes
|
||||||
|
|
||||||
kredis_flag :debounce_index_search_terms_flag
|
kredis_flag :debounce_index_search_terms_flag
|
||||||
|
|
||||||
|
|
|
@ -12,7 +12,7 @@ RSpec.describe InstructeurMailer, type: :mailer do
|
||||||
before { ENV['BULK_EMAIL_QUEUE'] = custom_queue }
|
before { ENV['BULK_EMAIL_QUEUE'] = custom_queue }
|
||||||
|
|
||||||
it 'enqueues email is custom queue for low priority delivery' do
|
it 'enqueues email is custom queue for low priority delivery' do
|
||||||
expect { subject.deliver_later }.to have_enqueued_job.on_queue(custom_queue)
|
expect { subject.deliver_later }.to have_enqueued_job(PriorizedMailDeliveryJob).on_queue(custom_queue)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue