mirror of
https://github.com/MBombeck/HealthLog.git
synced 2026-11-11 13:52:20 +00:00
A constantly-syncing client drips measurement batches every few minutes. Every batch deleted the dirtied per-metric assessment cache rows and re-enqueued a regeneration. The per-(user,scope,locale) enqueue singleton is only 120 s, so it could not coalesce across batches that arrive minutes apart, and each delete dropped the row a fresh enqueue would otherwise have found warm — so a metric card regenerated several times an hour and its assessment felt regenerated on every visit. Before evicting and re-enqueuing, check whether the scope's cached assessment was already (re)generated within a 30 min debounce window. A scope that is fresh is left intact and not re-enqueued; a genuinely stale or missing scope still refreshes immediately, so correctness holds. A timeout stub never counts as fresh, so a scope that recently stalled still retries. One indexed read per user answers it for every candidate scope at once. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> (cherry picked from commit 024baea664490ef0494add78c87492f01e61c6b9)