fix(calculation): #995 change-triggered evaluations coalesce latest-wins per calc tag, so a poll cycle evaluates once against all its new inputs and the queue is bounded by the tag count
At most one evaluation is pending per calc tag; a re-trigger only moves its timestamp forward and the dependency snapshot is taken when the pump dequeues it. Previously every dependency arrival enqueued a separate evaluation per dependent with a trigger-time snapshot: k inputs of one cycle ran k times (publishing intermediates computed from mixed old/new inputs) and the queue had no bound when triggers outpaced the pump. The out-of-process batch pump now dequeues every pending tag once per batch.
This commit is contained in:
@@ -86,6 +86,15 @@ Two deploy-time gates run over the result:
|
||||
comes back after an outage usually comes back holding the reading it had before, so a value-only
|
||||
dedup would swallow the recovery and leave the node Bad forever.
|
||||
- **Timers are grouped by interval**, one timer per distinct interval, not one per tag.
|
||||
- **Change triggers are latest-wins per tag (#995, review S-9).** A dependency change queues the calc tags that read
|
||||
it, but at most **one** evaluation is ever pending per tag: a tag already queued keeps its place and only takes the
|
||||
newer trigger timestamp, and its dependency snapshot is taken when the single evaluation pump *dequeues* it. So
|
||||
the inputs of one poll cycle that arrive while the pump is busy evaluate **once**, against all the new values —
|
||||
not once per input, where the first k−1 runs mixed new and previous-cycle values and published those
|
||||
intermediates (an `A − B` spike when A had updated and B had not). The queue is bounded by the number of calc
|
||||
tags, so triggers that outpace the pump (slow scripts, an out-of-process runner under load) no longer build an
|
||||
unbounded backlog of stale evaluations. With an out-of-process runner the pump submits everything it dequeued as
|
||||
one batch, which therefore never names a tag twice. Pinned by `CalculationDriverCoalescingTests`.
|
||||
|
||||
## Input quality
|
||||
|
||||
|
||||
Reference in New Issue
Block a user