Skip to content

Rate limit handling #185

@andre-vm

Description

@andre-vm

I need to update a contact's segments at once. Given that there's no request that allows me to set them all at once, I'm forced to call resend.Contacts.Segments.add(params) and resend.Contacts.Segments.remove(params) multiple times in a row, which will often cause a RateLimitError.

It would be nice to read the retry-after attribute from the response header in order to know how much I'll have to wait before retrying. But currently the SDK doesn't expose any of the header attributes in the exception object.

I see that #179 goes well in the direction of adding the response header to the returned objects. It would be nice have it added to the ResendError class as well.

I know this is a lot to ask, but even better would be to have the retry logic embedded in the SDK itself as an optional feature. The SDK could track the ratelimit-remaining and ratelimit-reset attributes from the responses of previously successful requests, and then avoid the rate limit error altogether by waiting in advance when the user runs out of remaining requests within the current window.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions