-
Notifications
You must be signed in to change notification settings - Fork 548
fix: Add network error retry support to auto-retry with exponential backoff #1128
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
base: main
Are you sure you want to change the base?
Conversation
…, and ECONNABORTED Co-authored-by: tiwarishubham635 <59199353+tiwarishubham635@users.noreply.github.com>
Co-authored-by: tiwarishubham635 <59199353+tiwarishubham635@users.noreply.github.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unit tests are failing. Please fix them.
@copilot
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@copilot
Unit tests are failing. Please fix them.
Co-authored-by: manisha1997 <28821901+manisha1997@users.noreply.github.com>
Fixed the test failure. The issue was a syntax error in the test file where I had incorrectly nested a describe block. Corrected the structure and all tests are now passing (26 test suites, 317 tests). Commit: 14d8c3f |
Fixed the test failure. The issue was a syntax error in the test file where I had incorrectly nested a describe block. Corrected the structure and all tests are now passing (26 test suites, 317 tests). Commit: 14d8c3f |
Co-authored-by: manisha1997 <28821901+manisha1997@users.noreply.github.com>
Just as a heads up, I was blocked by some firewall rules while working on your feedback. Expand below for details. Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
|
This PR extends the existing auto-retry functionality to handle transient network errors in addition to HTTP 429 responses. Previously, the
autoRetry
feature only retried on rate limiting errors, but intermittent network failures likeECONNRESET
,ETIMEDOUT
, andECONNABORTED
would cause requests to fail immediately.Changes Made
isRetryableError()
function identifies transient network errors that should be retriedgetExponentialBackoffErrorHandler()
that reuses the existing exponential backoff algorithm for network errorsautoRetry
is enabledRetryable Network Errors
The implementation conservatively retries only clearly transient network errors:
ECONNRESET
- Connection reset by peerETIMEDOUT
- Request timeoutECONNABORTED
- Request abortedConfiguration
Uses the same configuration options as the existing 429 retry functionality:
autoRetry: true
- Enables retry for both 429 responses and network errorsmaxRetries: 3
- Maximum retry attempts (default 3)maxRetryDelay: 3000
- Maximum delay between retries in milliseconds (default 3000)Example
Testing
This change improves the resilience of Twilio API calls without breaking existing functionality or requiring any configuration changes for users who want the enhanced behavior.
Fixes #1023.
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.