diff --git a/app/services/expired_dossiers_deletion_service.rb b/app/services/expired_dossiers_deletion_service.rb index 69358049a..2c1b45def 100644 --- a/app/services/expired_dossiers_deletion_service.rb +++ b/app/services/expired_dossiers_deletion_service.rb @@ -49,7 +49,7 @@ class ExpiredDossiersDeletionService user_notifications = group_by_user_email(Dossier.brouillon_expired) .map { |(email, dossiers)| [email, dossiers.map(&:hash_for_deletion_mail)] } - Dossier.brouillon_expired.destroy_all + Dossier.brouillon_expired.in_batches.destroy_all user_notifications.each do |(email, dossiers_hash)| DossierMailer.notify_brouillon_deletion(