Skip to content
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

Merged
merged 8 commits into from Jan 31, 2013

Conversation

geek
Copy link
Member

@geek geek commented Jan 30, 2013

Closes #360

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
Copy link
Contributor

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
Copy link
Contributor

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
Copy link
Contributor

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?

@hueniverse
Copy link
Contributor

Otherwise, ready to go.

hueniverse pushed a commit that referenced this pull request Jan 31, 2013
Adding support for server timeouts
@hueniverse hueniverse merged commit 6f1d8c3 into hapijs:develop Jan 31, 2013
jmonster pushed a commit to jmonster/hapi that referenced this pull request Feb 10, 2014
@lock lock bot locked as resolved and limited conversation to collaborators Jan 10, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants