Repository navigation
fix: a 429 from mail.tm no longer crashes the inbox server - #3
Merged
Merged
Conversation
Two handlers returned withToken(...) without await inside the request try/catch, so a rejection skipped the catch and became an unhandled rejection that killed the process. Now awaited, 429s are retried with Retry-After/backoff, passed to the browser as 429, and the ui command logs any stray rejection instead of exiting. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Review follow-up. The async request handler is now wrapped once, so an error that escapes any route answers 500 instead of killing the server or hanging the request; the process-wide unhandledRejection logger is gone. 429 retries live in a shared fetchMailTm helper, also used by the attachment download, with jittered backoff, and give up at once when Retry-After is longer than the cap. 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.
Summary
withToken(...)withoutawaitinside the handler's try/catch, so a 429 from mail.tm skipped the catch, became an unhandled rejection and killed the server (the Mac app showed "The inbox server stopped").fetchMailTmhelper (also used for attachments): Retry-After when given, jittered backoff otherwise, and an immediate give-up when Retry-After exceeds 10s.Test plan
npm test— 48/48, incl. newtest/ratelimit.test.js(fails/hangs against the old code)Not addressed: throttling requests to mail.tm up front (~8 req/s), and the "all" view still shows a rate-limited mailbox as empty.
🤖 Generated with Claude Code