Skip to content

Meta option to handle rate limiting (HTTP 429) #52

Closed
@gerukin

Description

Often endpoints are rate limited. Sometimes by endpoint and sometimes by API key (or both). Usually by span of time between requests or by max requests in span of time. I think it would be difficult to try to perfectly handle all scenarios, but something approximative can still be very useful.

A # @wait ??? could be used for each request to indicate the number of ms to wait before [re]executing the request.

A slightly better version IMO could be # @interval ??? which would wait just long enough to make sure ??? ms have passed since the last executed request (ex: if this is the first request, it doesn't wait at all, if the last request was executed 2s ago, it waits only ??? - 2s, which may be 0).

Maybe this is enough to handle most use cases (although it might be a bit wasteful in max requests in span of time scenarios, they can still be addressed). It would certainly be enough to take care of my own.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions