Skip to content

Commit

Permalink
[gh-#887] retry on connection reset
Browse files Browse the repository at this point in the history
  • Loading branch information
khaliqgant committed Aug 8, 2023
1 parent 7a38fa8 commit 368fc9b
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions packages/server/lib/controllers/proxy.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -295,8 +295,10 @@ class ProxyController {
* @param {attemptNumber} number
*/
private retry = async (activityLogId: number, error: AxiosError, attemptNumber: number): Promise<boolean> => {
if (error?.response?.status.toString().startsWith('5') || error?.response?.status === 429) {
const content = `API received an ${error?.response?.status} error, retrying with exponential backoffs for a total of ${attemptNumber} times`;
if (error?.response?.status.toString().startsWith('5') || error?.response?.status === 429 || error?.code === 'ECONNRESET') {
const content = `API received an ${
error?.response?.status || error?.code
} error, retrying with exponential backoffs for a total of ${attemptNumber} times`;

await createActivityLogMessage({
level: 'error',
Expand Down

0 comments on commit 368fc9b

Please sign in to comment.