-
Notifications
You must be signed in to change notification settings - Fork 91
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #9797 from demarches-simplifiees/US/fix-reset-expi…
…ring-dossiers-job correctif(ResetExpiringDossiersJob): timeout sur la prod, utilise une requete plus générique mais plus rapide [on ne scope pas aux dossiers ayant ete notifies, on les reset tous car ca timeouté
- Loading branch information
Showing
2 changed files
with
17 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,15 @@ | ||
class ResetExpiringDossiersJob < ApplicationJob | ||
def perform(procedure) | ||
procedure.dossiers | ||
.where.not(brouillon_close_to_expiration_notice_sent_at: nil) | ||
.or(Dossier.where.not(en_construction_close_to_expiration_notice_sent_at: nil)) | ||
.or(Dossier.where.not(termine_close_to_expiration_notice_sent_at: nil)) | ||
procedure | ||
.dossiers | ||
.in_batches do |relation| | ||
relation.update_all(brouillon_close_to_expiration_notice_sent_at: nil, | ||
en_construction_close_to_expiration_notice_sent_at: nil, | ||
termine_close_to_expiration_notice_sent_at: nil) | ||
relation.each do |dossier| | ||
if dossier.expiration_started? | ||
dossier.update(brouillon_close_to_expiration_notice_sent_at: nil, | ||
en_construction_close_to_expiration_notice_sent_at: nil, | ||
termine_close_to_expiration_notice_sent_at: nil) | ||
end | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters