Repository navigation
fix: listen to mail.tm's push stream instead of polling into its rate limit - #5
Merged
Merged
Conversation
… limit mail.tm now allows 30 requests a minute per IP. Polling every mailbox every 4 seconds sent 150 a minute per server (and the app and the LaunchAgent each run one), so opening a message got a 429 and the reading pane stayed on the previous mail; the All mailboxes view silently came back empty. Each mailbox now has a Mercure stream; an event refreshes only that mailbox (debounced). The inbox is served from that cache while the stream is up, a safety-net check runs every 5 minutes per live mailbox and never more than 3 per 20 s, and mutations refresh only the mailboxes they touched. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
- a reconnect refreshes unless a check started after the stream went down - an idle watchdog (75 s, Mercure keeps alive every 30 s) drops dead sockets - the inbox is also served from a list fetched in the last 20 s, so a Mercure outage does not bring back a request per mailbox per page load - a 401 from Mercure renews the token at most every 5 minutes; failed responses release their body - events are parsed per line and only data: lines count - a push event is skipped when a check already started after it, so the server's own changes no longer cost a second refresh - an expired mailbox replaced mid-refresh gets its stream, and deleted mailboxes leave no state behind - stream outages are logged once, not swallowed - version 1.4.1 Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.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.
Why
mail.tm now allows 30 requests a minute per IP (
ratelimit-policy: 30; w=60). Every catchbox server polled every mailbox every 4 s — 150/min per server, and the Mac app and thecatchbox uiLaunchAgent each run one. Opening a message got a 429, so the reading pane stayed on the previous mail; "All mailboxes" came back silently empty.What
Measured locally: after the start-up check, 0 requests a minute to mail.tm with 10 mailboxes (was ~150).
Test plan
node --test— 53/53, five new tests (cache while live, debounced burst, split keep-alive, reconnect catch-up, no double refresh on the server's own change)brew upgrade catchbox+ restart the LaunchAgent🤖 Generated with Claude Code