Skip to content

Commit

Permalink
CONFIG.ERRORS_TO_RETRY
Browse files Browse the repository at this point in the history
  • Loading branch information
nleush committed Jul 2, 2024
1 parent 7d5061f commit 0f8fa48
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
10 changes: 9 additions & 1 deletion config.js
Original file line number Diff line number Diff line change
Expand Up @@ -358,7 +358,15 @@
"twitter.status": {}
},

LOG_DATE_FORMAT: "\\[YY-MM-DD HH:mm:ss\\]:"
LOG_DATE_FORMAT: "\\[YY-MM-DD HH:mm:ss\\]:",

ERRORS_TO_RETRY: [
'ECONN',
'EAI_AGAIN',
'ENET',
'HPE_INVALID_',
'ERR_SSL_'
]
};

// Providers config loader.
Expand Down
10 changes: 1 addition & 9 deletions lib/fetch.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,6 @@ const fetchH1 = h1NoCache({
rejectUnauthorized: false // By default skip auth check for all.
}).fetch;

const ERRORS_TO_RETRY = [
'ECONN',
'EAI_AGAIN',
'ENET',
'HPE_INVALID_',
'ERR_SSL_'
];

function doFetch(fetch_func, h1_fetch_func, options) {

const fetch_options = Object.assign({}, options);
Expand Down Expand Up @@ -98,7 +90,7 @@ function doFetch(fetch_func, h1_fetch_func, options) {
log(' -- doFetch h2 aborted error', uri);
resolve(doFetch(fetch_func, h1_fetch_func, Object.assign({}, options, {disable_http2: true})));

} else if (!options.stopRecursion && ERRORS_TO_RETRY.some(code => error.code?.indexOf(code) > -1)) {
} else if (!options.stopRecursion && CONFIG.ERRORS_TO_RETRY.some(code => error.code?.indexOf(code) > -1)) {

log(' -- doFetch ECONNRESET retry', error.code, uri);
resolve(doFetch(fetch_func, h1_fetch_func, Object.assign({}, options, {stopRecursion: true, disable_http2: true})));
Expand Down

0 comments on commit 0f8fa48

Please sign in to comment.