fix(timeout): timeouts are fatal

This commit is contained in:
Geoff Cox 2018-01-21 07:45:58 -08:00
parent 2339c75437
commit 116d930295
2 changed files with 11 additions and 3 deletions

View file

@ -46,7 +46,7 @@
"dependencies": {
"backoff-promise": "^0.0.3",
"bluebird": "^3.5.0",
"quelle": "^1.0.1",
"quelle": "^1.0.2",
"request": "^2.81.0",
"sporks": "^1.0.0",
"squadron": "^0.0.4"

View file

@ -196,11 +196,19 @@ EnhancedRequest.prototype._shouldReconnect = function (err) {
'Failed to fetch', // ECONNREFUSED/ENOTFOUND in Chrome
'Type error', // ECONNREFUSED/ENOTFOUND in Safari
'XHR error', // ECONNREFUSED/ENOTFOUND in Firefox
'EAI_AGAIN', // Transient DNS error
'EAI_AGAIN' // Transient DNS error
// TODO: It is not clear why CouchDB responds with these timeout errors and immediately
// retrying the request often leads to deadlocks when you are continuously listening. In
// practice, it is better that your app throws a fatal error and then is restarted, e.g. via
// Docker, as this seems to reliably recover from this state. At some point we should analyze
// this better and determine where the bug lies and fix it at the root cause:
// https://github.com/redgeoff/spiegel/issues/100
//
// Occurs randomly even when there is a relatively small amount of data, e.g. "The request
// could not be processed in a reasonable amount of time"
'timeout'
//
// 'timeout'
].join('|'), 'i').test(err.message);
}
};