Repository navigation
[19.0][FIX] kpi: compute recurring KPIs more than once - #1249
Open
miquelrosell99 wants to merge 3 commits into
Open
miquelrosell99 wants to merge 3 commits into
miquelrosell99 wants to merge 3 commits into
Conversation
The scheduler domain ["&", "|", (active), (due), (never scheduled)] parses as (active OR due) AND (never scheduled), so a computed KPI is picked up exactly once: as soon as next_execution_date is set, the KPI is never computed again. Require active AND (due OR never scheduled). Also: - catch compute errors per KPI so one failing KPI no longer silently skips the rest of the batch - build next_execution_date from fields.Datetime.now() instead of naive local datetime.now() - fix kpi.history name default evaluated once at server boot
Contributor
|
Hi @max3903, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The scheduler domain
parses as
(active OR due) AND (never scheduled), so a computed KPI is picked up exactly once: as soon asnext_execution_dateis set after the first run, the KPI never matches again and is never recomputed.Fixed to
active AND (due OR never scheduled).Also in this PR:
try/exceptaround the whole loop aborted the remaining KPIs)next_execution_datefromfields.Datetime.now()instead of naive localdatetime.now()formatted withDEFAULT_SERVER_DATETIME_FORMATkpi.historynamedefault:default=fields.Datetime.now()is evaluated once at server boot, so every unnamed history row gets the boot timestampTests: two new scheduler tests (rescheduling a due KPI, and batch isolation when one KPI raises).