smoothbrain-ai / smoothbrain-anki

SmoothBrain is an Anki plugin that fetches Readwise highlights and makes flashcards using OpenAI GPT.
39 stars 6 forks source link

Backoff/retry/log when rate-limited #10

Open alexbowe opened 1 year ago

alexbowe commented 1 year ago

Readwise's API rate-limits, which could make responses not have a "results" section as seen in #1.

We should backoff and try again (probably using Python's backoff lib)

alexbowe commented 1 year ago

I attempted to overload the rate limiter and could not reproduce the bug, so this may not be a high priority right now. Removing from epic. Will prioritize it if people start to report problems around it.

alexbowe commented 1 year ago

from https://readwise.io/api_deets:

Rate Limiting The default base rate is 240 requests per minute but the Highlight LIST and Book LIST endpoints are restricted to 20 per minute. You can check Retry-After header in the 429 response to get the amount of seconds to wait for.