Calendar entries from a plugin: add_reminder rewrites an unchanged entry on every sync, so the dashboard's figures are worked out again each hour #1164
Labels
No labels
accessibility
authentication
breaking change
bug
documentation
enhancement
interface
internationalisation
observability
performance
security
tier
1
tier
2
tier
3
tier/4
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
Postulo/postulo#1164
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
What exists today
tiagoagueda/postulo-francetravail on the forge's
main(033cd90),src/postulo_francetravail/account.py:270-311_calendar: on every run, for each of the comingMONTHS_AHEAD = 3months (line 57), it callsapi.add_reminderfor every wanted entry (the declaration, its reminder, the payment: up to three a month) and counts each one inreport.pushed, whether or not anything changed.Core,
src/postulo/applications/services.py:1073-1140add_reminder: when the uid already exists it assigns summary, note, due date,retired_at = Noneand actor, and callssave(update_fields=[…, "updated_at"])unconditionally (lines 1122-1139). So every run movesupdated_aton 6 to 9 reminders that did not change.src/postulo/applications/analytics.py:339-420fingerprintincludesMax("updated_at")of the person's reminders (lines 374-376, 399-401) in the insights cache key, andinsights_for(lines 422-441) rebuilds the figures on a miss (build, from line 444, loads every application with its posting, company and industries). So each France Travail run invalidates the dashboard's figures, and the next view of the dashboard (core/widgets.py:375) pays the full build. The same holds for any other plugin or calendar import that callsadd_reminderagain with the same values.The connection's report also says "N pushed" on every run although nothing was pushed.
What would change
Core: in
add_reminder, compare the incoming values with the stored ones (summary cut to 250, note,due_at,retired_at is None, actor cut to its field) and return without saving when they are equal. To let a caller report honestly, also say whether anything was written, either as a second return value under a new name or as an attribute on the returned reminder (for examplereminder.changed), keeping the current return type for existing callers. A test asserts that a second identical call leavesupdated_atand the insights fingerprint unchanged.tiagoagueda/postulo-francetravail, once it pins that core: count
report.pushedonly for entries that were created or changed.What it saves or protects
small: 6 to 9 needless
UPDATEs per France Travail run stop, and with them the insights cache miss they cause: the next dashboard view after every run (hourly by default) no longer rebuilds the figures from every application, event and listingAccessibility
none
Decisions
add_reminderskips an unchanged entry and says whether it wrote) and a small postulo-francetravail issue (count only what changed), the second after the first.Found by the efficiency and reliability audit of 2026-10-30 (finding PR13; index postulo/postulo#1108). Checked against
mainatdaee30b15(2026-10-30).The other half of this finding is tiagoagueda/postulo-francetravail#21.