Gmail: skip failed gets, throttle concurrent requests#2
Merged
Conversation
A single non-200 response or decode error from messages.get used to throw out of the task group and surface as "Partial: kmatzen@gmail.com · The data couldn't be read because it is missing." — the localized form of DecodingError.valueNotFound when Google returned an error JSON with no id field. Per-message failures now log the HTTP status + truncated body (or named DecodingError case + body) and return .errored, so one bad message no longer tanks the inbox view. The summary line splits intentional category filtering from real errors: "kept N, filtered M, errored K". Cap concurrent in-flight gets at 8. Confirmed via the new logs that the original failure was Gmail's "Too many concurrent requests for user." 429 — firing 35+ simultaneous gets blew through the per-user concurrent quota. Co-Authored-By: Claude Opus 4.7 (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
messages.getfailures (non-200 or decode error) no longer fail the whole Gmail fetch — they log the HTTP status + body (or namedDecodingErrorcase + body) and are skipped.messages.getrequests are capped at 8. Gmail returns HTTP 429"Too many concurrent requests for user."well before any per-second quota kicks in; firing 35+ simultaneous gets reliably blew through the per-user concurrent limit.kept N, filtered M, errored K.Context
The user-visible symptom was
"Partial: kmatzen@gmail.com · The data couldn't be read because it is missing."— the localizedDecodingError.valueNotFoundforidthrown whenJSONDecoderwas handed Google's error JSON. Two compounding bugs: no HTTP status check before decode, andwithThrowingTaskGroupre-throwing the first failure aborted all 35+ in-flight gets. New diagnostic logs confirmed the underlying cause was a 429rateLimitExceeded/RESOURCE_EXHAUSTED.Test plan
swift buildcleanmake runand trigger a refresh — verifiederrored 0(or near-zero) in the new summary line, full inbox visible~/Library/Application Support/Lede/lede.logover a normal day's refresh cycle