Commit graph

20 commits

Author SHA1 Message Date
Martin
d45a250075 amelioration(mail): ajoute d'un simili rate limiter pour envoyer les mails sur des fenetres de temps ayant une limite 2023-06-26 17:28:27 +02:00
Martin
8a42aa2117 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 2023-06-20 17:46:58 +02:00
Colin Darie
520142a9c6 fix(job): Cron::ExpiredDossiersDeletionJob destroy brouillon expired in batch 2023-03-13 10:32:53 +01:00
Colin Darie
9512ac467c fix(job): attempt for timeout on Cron::ExpiredDossiersDeletionJob 2023-03-01 19:00:52 +01:00
Paul Chavard
3d8471e064 fix(dossier): do not send notification on expiration when dossier is already deleted 2022-01-19 17:52:53 +01:00
Martin
1bb868714c fix(spec/lint/review): lint and fix spec of previous commits, also fix based on tchak feedback 2021-12-06 07:05:17 +01:00
Paul Chavard
0e2f09dd6f fix(dossiers): wrap dossier discard in a transaction
By doing this we ensure that deleted_dossier are not created when dossier is not discarded
2021-11-02 18:17:35 +01:00
Paul Chavard
20705d6e30 Do not send draft norifications to users on inactive démarches 2020-05-27 16:36:46 +02:00
Pierre de La Morinerie
9f1407b6d7 expiration: fix the mailer arguments
The mailers expect serializable arguments, but were given
ActiveRecord::Relation objects instead. This made the mailers throw an
exception.

But how was that possible ? This code is tested, and the tests were
green.

Well, the specs spy on the mailer implementation, in order to check that
the mailers methods were properly called. Fair enough.

But if the specs mock the mailer code (instead of calling the original
implementation), we may not notice that the original implementation
rejects our method parameters.

Here this is the case: once we actually call the original implementation
the tests start to fail, because some arguments are not converted from
an ActiveRecord::Relation to a serializable array.

This is fixed by ensuring that the mailer code is executed (and doesn't
throw an exception).
2020-05-18 16:24:08 +02:00
Paul Chavard
b849fc6fc3 Mark as sent or destroy right after each notification is sent to enable a better recovery in case of mid loop failures 2020-04-23 09:36:09 +02:00
Paul Chavard
31943f7d9c Add handeling of expired processed dossiers to deletion service 2020-04-22 15:39:10 +02:00
Paul Chavard
7ba4c513e6 Refactor notify near deletion mailers 2020-04-01 17:40:52 +02:00
Paul Chavard
5b5ae5a7a5 Do not send notifications or create operation logs on brouillon demarches 2020-03-25 15:04:52 +01:00
Paul Chavard
5c2eba1dd1 Always add a reason to dossier deletion 2020-03-24 09:30:11 +01:00
Paul Chavard
cd0acb1344 Cleanup dossier mailers 2020-03-19 16:52:18 +01:00
simon lehericey
ede61ee22b refacto 2020-03-18 15:25:02 +01:00
simon lehericey
50bb2e6a08 refacto 2020-03-18 15:25:02 +01:00
simon lehericey
f35c0518b7 test for #delete_expired_en_construction_and_notify 2020-03-18 15:25:02 +01:00
Paul Chavard
fe1cd2a47b Delete and notify en_construction dossiers 2020-03-18 15:25:02 +01:00
Paul Chavard
f35ccc9d92 Move process_expired_dossiers_brouillon to a service 2020-03-18 15:25:02 +01:00