Skip to content

Preavis - Invalidation des préavis zéro bft ou swo zero créé il y a plus de 24 heures#5069

Draft
n0izn0iz wants to merge 1 commit intomasterfrom
norman/4334-automatic-pno-invalidation
Draft

Preavis - Invalidation des préavis zéro bft ou swo zero créé il y a plus de 24 heures#5069
n0izn0iz wants to merge 1 commit intomasterfrom
norman/4334-automatic-pno-invalidation

Conversation

@n0izn0iz
Copy link
Copy Markdown
Collaborator

@n0izn0iz n0izn0iz commented May 2, 2026

WIP

Fixes #3484

Signed-off-by: Norman <7917064+n0izn0iz@users.noreply.github.com>
@n0izn0iz n0izn0iz self-assigned this May 2, 2026
@tristanrobert
Copy link
Copy Markdown

Snyk checks have passed. No issues have been found so far.

Status Scan Engine Critical High Medium Low Total (0)
Open Source Security 0 0 0 0 0 issues

💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse.

@sonarqubecloud
Copy link
Copy Markdown

sonarqubecloud Bot commented May 2, 2026

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")),
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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?
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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?
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same pour le log. Mais laissons tourner quand même le CRON


val logbook =
jpaLogbookReportRepository
.findAllAcknowledgedPriorNotifications(filter) // QUESTION: is "acknowledged" good?
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants