diff options
-rw-r--r-- | lib/api.js | 11 |
1 files changed, 8 insertions, 3 deletions
@@ -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) { |