Skip to content

Correct the completeness signal, and fix the interval drift it exposed - #2

Merged
alexey-milovidov merged 1 commit into
masterfrom
fix-poll-scheduling
Aug 17, 2026
Merged

Correct the completeness signal, and fix the interval drift it exposed#2
alexey-milovidov merged 1 commit into
masterfrom
fix-poll-scheduling

Conversation

@alexey-milovidov

Copy link
Copy Markdown
Member

Follow-up to #1. Two claims made there were wrong, and measuring properly exposed a scheduling bug.

What was wrong

A single response from /events is an unordered sample of the recent window, not the strict newest 100. Two adjacent responses can therefore barely overlap while their union still covers everything. So:

What the aggregate actually shows

Page 1, 20 second windows:

interval requests/s events/s captured overlap largest timestamp gap
0.5 s 1.80 100.0 46% 1.0 s
2.0 s 0.50 50.0 0% 2.0 s
4.0 s 0.25 25.0 0% 4.0 s

Unique events scale linearly with the length of the window (1100 in 10 s, 3101 in 30 s) and timestamps within the covered period are contiguous, so this is a complete stream at about 100 events/second — and two polls a second capture all of it.

More clients cannot help. Four concurrent workers at 7.7 requests/second found one extra event over a single worker at 1.9 requests/second across the same window, while the already-seen fraction rose from 44% to 87% — the extra requests only re-fetched what was already captured. Extra tokens buy the quota to sustain the poll rate, not extra coverage.

The right signal, and the bug it found

The check is now the overlap between polls, aggregated per page per minute. Healthy is comfortably above zero; a page sitting at 0% for a whole minute means consecutive polls never met and the difference was dropped.

Reporting that immediately turned up a bug in #1: the next poll was scheduled from the moment the response came back, so every interval was silently stretched by a round trip and page 1 ran at 0.85 requests/second instead of 2. It now schedules from the moment the request goes out.

before: 103 polls/minute, overlap p1:0%  p2:21% p3:94%, warning on page 1
after:  193 polls/minute, overlap p1:42% p2:57% p3:97%, no warning

42% matches the 46% measured independently at 1.8 requests/second, so all three pages are now fully covered. Latest run: 10681 events, 16 types, 0 duplicates, 72% push / 28% non-push.

🤖 Generated with Claude Code

Follow-up to #1. Two claims made there were wrong, and measuring properly
exposed a scheduling bug.

A single response from /events is an unordered sample of the recent window
rather than the strict newest 100, so two adjacent responses can barely overlap
while their union still covers everything. The per-poll "all 100 entries are
new" check added in #1 therefore fired constantly on page 1 without any events
actually being lost, and the claim that pushes "cannot be captured completely at
any affordable polling rate" was drawn from that same misreading.

What the aggregate actually shows, measured on page 1 over 20 second windows:

  interval  requests/s  events/s captured  overlap  largest timestamp gap
     0.5 s        1.80              100.0      46%                  1.0 s
     2.0 s        0.50               50.0       0%                  2.0 s
     4.0 s        0.25               25.0       0%                  4.0 s

The stream runs at about 100 events/second and unique events scale linearly with
the length of the window, so it is a complete stream and two polls a second
capture all of it. Polling harder buys nothing: four concurrent workers at 7.7
requests/second found one extra event over a single worker at 1.9, with the
already-seen fraction rising from 44% to 87%. More clients cannot raise the
ceiling, because at this rate there is none.

So the signal to watch is the overlap between polls, aggregated per page per
minute: healthy is comfortably above zero, and a page at 0% for a whole minute
means consecutive polls never met and the difference was dropped.

Reporting that immediately turned up a bug in #1: the next poll was scheduled
from the moment the response came back, so each interval was silently stretched
by a round trip and page 1 ran at 0.85 requests/second instead of 2. It now
schedules from the moment the request goes out.

  before: 103 polls/minute, overlap p1:0%  p2:21% p3:94%, warning on page 1
  after:  193 polls/minute, overlap p1:42% p2:57% p3:97%, no warning

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@alexey-milovidov
alexey-milovidov merged commit 86125f7 into master Aug 17, 2026
@alexey-milovidov
alexey-milovidov deleted the fix-poll-scheduling branch August 17, 2026 00:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant