mirror of
https://github.com/block/buzz.git
synced 2026-11-09 02:41:57 +00:00
fix(desktop): discard stale longtask deliveries at perf-sample start
Blind-review round 5 (Fable medium) finding: a longtask trailing switch N is delivered by the PerformanceObserver in a later task and landed in switch N+1's freshly reset array, inflating its longtask lines. Drain takeRecords() and discard before each sample's reset. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Signed-off-by: Max Lampert <maxwell@squareup.com>
This commit is contained in:
@@ -94,6 +94,10 @@ async function measureSwitch(
|
||||
__LONGTASKS__: number[];
|
||||
__LONGTASK_OBSERVER__?: PerformanceObserver;
|
||||
};
|
||||
// Discard pending deliveries from BEFORE this sample: a longtask
|
||||
// trailing the previous switch is delivered in a later task and would
|
||||
// otherwise land in this sample's fresh array.
|
||||
store.__LONGTASK_OBSERVER__?.takeRecords();
|
||||
store.__LONGTASKS__ = [];
|
||||
const link = document.querySelector<HTMLElement>(
|
||||
`[data-testid="${args.targetTestId}"]`,
|
||||
|
||||
Reference in New Issue
Block a user