fix(notion-client): wait out rate-limit cooldowns instead of backing off
The initial retry policy backed off from 1s (1s -> 2s -> 4s, 30s cap), which cannot succeed against this API: once a client trips a rate limit, Notion applies a fixed cooldown, so every quick retry lands inside the same window and just burns the retry budget before surfacing the failure. - On 429, wait out the cooldown (60s plus jitter) rather than backing off from a short delay. - Raise the max delay from 30s to 60s. - Use full jitter (uniform over [0, exponential]) for transient errors, which decorrelates retry waves better than a fixed fraction of the window. - Narrow the retried status codes to [408, 429, 500, 502, 503, 504], dropping 409 and 425. Private pages return 400 and now fail fast instead of consuming retries. 500 is kept because ofetch synthesizes it for transport-level failures. - Classify on response status before touching the body, and tolerate non-JSON error bodies. Read the optional clientData.retryAfter hint as a fallback, since these responses generally carry no Retry-After header. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
S
Stephen Wu committed
aa97e874f6320071ae25626034acde6a8a2e5870
Parent: 12bc86b