New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Adding support for server timeouts #430
Conversation
self._serverTimeoutId = setTimeout(function () { | ||
|
||
sendResponse(Err.serverTimeout('Server is taking too long to respond')); | ||
}, self.server.settings.timeout.server - (Date.now() - self._timestamp)); // Calculate the timeout from when the request was constructed |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In case too long has passed, check for <= 0 and timeout immediately if needed.
|
||
var funcsIterator = function (func, next) { | ||
|
||
if (self._isReplied === true) { // Short circuit request if a reply already occurred |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nooooo... this might look like a good idea but we don't want to disturb the flow. For example, if you finished the handler but failed validation, and you exit in between, you would leave the crap in the cache (if it was cached).
function (err) { | ||
var reply = function (err) { | ||
|
||
if (self._isReplied === true) { // Prevent any future responses to this request |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why isn't this a local function variable?
Otherwise, ready to go. |
Adding support for server timeouts
Adding support for server timeouts
Closes #360