Skip to content

Handle rate limiting #1114

Open
Open
@kylefox

Description

@kylefox

Is your feature request related to a problem? Please describe.

It's a bit difficult to gracefully handle Stripe's rate limits when there are various places within an application that make requests to the API.

This is particularly a problem for Stripe Connect applications (or Stripe Apps) where an unexpected surge in volume from a connected account can cause a flurry of API requests from the application.

Describe the solution you'd like

I'm not sure if it's technically feasible (or even possible) but it would be amazing if the Stripe Ruby client could internally manage rate limit errors automatically.

I suspect the biggest challenge/barrier would be the delay that results from exponentially backing off retries, which is a blocking operation. An async approach could work, but that might make the API for this library too complex.

Describe alternatives you've considered

We have investigated token buckets and using Sidekiq to queue/throttle API requests, but both of those solutions are non-trivial for an application like ours (Stripe App / Connect extension) that has a high surface area with the Stripe API.

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions