Preavis - Invalidation des préavis zéro bft ou swo zero créé il y a plus de 24 heures#5069
Preavis - Invalidation des préavis zéro bft ou swo zero créé il y a plus de 24 heures#5069
Conversation
Signed-off-by: Norman <7917064+n0izn0iz@users.noreply.github.com>
✅ Snyk checks have passed. No issues have been found so far.
💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse. |
|
| createdBefore = ZonedDateTime.now().minusHours(24), | ||
| specyCodes = listOf("BFT", "SWO"), | ||
| // TODO: refactor the willArriveBefore and willArriveAfter fields to be nullable | ||
| willArriveAfter = ZonedDateTime.of(Integer.MIN_VALUE, 0, 0, 0, 0, 0, 0, ZoneId.of("UTC")), |
There was a problem hiding this comment.
Tu ne pourras pas enlever willArriveAfter & willArriveBefore car ces deux champs sont utilisés par TimescaleDB pour chercher dans les bons chunks.
Et un MIN/MAX value va parcourir tous les chunks et avoir trop d'impact perf.
Etant donné que le CRON tourne toutes les 5 minutes, tu peux juste chercher sur une fenêtre de -48h à -24h je pense. Et d'ailleurs tu peux enlever le filtre createdBefore non ?
Etant donné qu'on veut invalider les PNOs plus vieux de 24h.
| .findAll(filter) | ||
| .forEach { | ||
| if (it.reportId == null) { | ||
| return // QUESTION: should throw? |
There was a problem hiding this comment.
On peut mettre un logger.warn ? Histoire de check dans les logs
| .findAllAcknowledgedPriorNotifications(filter) // QUESTION: is "acknowledged" good? | ||
| .forEach { | ||
| if (it.reportId == null) { | ||
| return // QUESTION: should throw? |
There was a problem hiding this comment.
Same pour le log. Mais laissons tourner quand même le CRON
|
|
||
| val logbook = | ||
| jpaLogbookReportRepository | ||
| .findAllAcknowledgedPriorNotifications(filter) // QUESTION: is "acknowledged" good? |
There was a problem hiding this comment.
Oui, on ne veut que les PNOs pour lesquels on a reçu un message ACK (validation métier pas l'appli qui nous envoie la donnée)



WIP
Fixes #3484