Problem
When X returns HTTP 429 (rate limited), all methods immediately fail and return an error. Users must manually re-run commands.
This is especially painful during pagination operations (search --all, bookmarks --all) where partial progress is lost.
Proposed solution
Add automatic retry with exponential backoff:
- Detect 429 responses in
fetchWithTimeout or a wrapper
- Retry up to N times (default: 3) with exponential delay (1s, 2s, 4s)
- Respect
Retry-After header if present
- Make max retries configurable via constructor option
const client = new XReaderClient({
cookies: { ... },
maxRetries: 3, // default: 3
retryDelay: 1000, // base delay in ms
});
Additional context
The paginated methods already have hardcoded sleeps (1000ms for search, 500ms for bookmarks), but these are preventive, not reactive. Both approaches should coexist.
Problem
When X returns HTTP 429 (rate limited), all methods immediately fail and return an error. Users must manually re-run commands.
This is especially painful during pagination operations (
search --all,bookmarks --all) where partial progress is lost.Proposed solution
Add automatic retry with exponential backoff:
fetchWithTimeoutor a wrapperRetry-Afterheader if presentAdditional context
The paginated methods already have hardcoded sleeps (1000ms for search, 500ms for bookmarks), but these are preventive, not reactive. Both approaches should coexist.