Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature Request: Add hook for 429 retry logic #936

Open
ccwurtz opened this issue Jun 8, 2023 · 2 comments
Open

Feature Request: Add hook for 429 retry logic #936

ccwurtz opened this issue Jun 8, 2023 · 2 comments
Labels
status: help wanted requesting help from the community type: twilio enhancement feature request on Twilio's roadmap

Comments

@ccwurtz
Copy link

ccwurtz commented Jun 8, 2023

Description

Currently, if configured the twilio-node library automatically retries requests when it encounters a 429 error, but there's no way to be notified or modify this behavior.

Proposal

Add an optional onRetry parameter to the twilio() function that accepts a callback to be called whenever a 429 error is encountered. This would allow users to handle or log these errors in a custom way.

Example usage:

import { Twilio } from 'twilio';

const client = new Twilio(accountSid, authToken, {
  onRetry: (attempt: number, delay: number) => {
    console.log(`Retrying after ${delay}ms (attempt ${attempt})`);
    return true; // continue with retry
  },
});

I'd be happy to submit a PR to implement this.

@AsabuHere
Copy link
Contributor

Hi @ccwurtz,
Thank you for the heads up!
We have added this enhancement request to our backlog. Pull requests and +1s on the issue will help it move up the backlog. It would be great if you can submit a PR implementing this

Thanks,
Athira

@AsabuHere AsabuHere added status: help wanted requesting help from the community type: twilio enhancement feature request on Twilio's roadmap labels Jul 5, 2023
@GuiSim
Copy link

GuiSim commented Jan 12, 2024

Scope creeping here: But having the ability to choose which error codes should be retried would help. As multiple people have reported in this repository over time, Twilio's API sometimes throws a 404 for a valid request and I'd like to see these retried automatically.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: help wanted requesting help from the community type: twilio enhancement feature request on Twilio's roadmap
Projects
None yet
Development

No branches or pull requests

3 participants