Merge pull request #9220 from mfo/US/fix-expiration-job

correctif(dossiers.expirations): sur de gros volumes de données, le fait de mettre a jours tous les dossiers a supprime timeout face a PG. batch la maj
This commit is contained in:
Colin Darie 2023-06-21 13:33:50 +00:00 committed by GitHub
commit 508b3c36fe
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -73,7 +73,7 @@ class ExpiredDossiersDeletionService
user_notifications = group_by_user_email(dossiers_close_to_expiration)
administration_notifications = group_by_fonctionnaire_email(dossiers_close_to_expiration)
dossiers_close_to_expiration.update_all(close_to_expiration_flag => Time.zone.now)
dossiers_close_to_expiration.in_batches.update_all(close_to_expiration_flag => Time.zone.now)
user_notifications.each do |(email, dossiers)|
DossierMailer.notify_near_deletion_to_user(dossiers, email).deliver_later