Correct the completeness signal, and fix the interval drift it exposed - #2
Merged
Conversation
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>
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.
Follow-up to #1. Two claims made there were wrong, and measuring properly exposed a scheduling bug.
What was wrong
A single response from
/eventsis 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:
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.
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