summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/api.js11
1 files changed, 8 insertions, 3 deletions
diff --git a/lib/api.js b/lib/api.js
index ae05c7f..4ee5c5d 100644
--- a/lib/api.js
+++ b/lib/api.js
@@ -68,12 +68,17 @@ function send_this(data) {
return data.resolve(response);})
.catch(err => {
fs.writeFileSync('log', JSON.stringify({event: 'error', date: new Date(), data: err}) + '\n', {flag: 'a+'});
- if (err.cause?.code === 'UND_ERR_CONNECT_TIMEOUT') {
+ switch(err.cause?.code) {
+ case 'ECONNRESET':
send_this(data);
- } else {
+ break;
+ case 'UND_ERR_CONNECT_TIMEOUT':
+ send_this(data);
+ break;
+ default:
data.reject(err)
}});
- setTimeout(send_next, 500);
+ setTimeout(send_next, 400); // 333 should work, but 400 will still allow manual requests to go through during development
}
export function debugLog(ctx) {