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

fix: set default idle timeout to 4 seconds #279

Merged
merged 4 commits into from
Jul 30, 2020
Merged

Conversation

ronag
Copy link
Member

@ronag ronag commented Jul 30, 2020

Node HTTP server seem to have a default of 5 seconds and
we should be below that.

Fixes: #276

Node HTTP server seem to have a default of 5 seconds and
we should be below that.

Fixes: #276
@ronag ronag requested a review from mcollina July 30, 2020 15:03
@ronag
Copy link
Member Author

ronag commented Jul 30, 2020

@szmarczak

lib/client.js Outdated
// Set timeout to half of hint to account for timing inaccuracies.
client[kKeepAliveTimeout] = Math.min(keepAliveTimeout - 500, client[kIdleTimeout])
let keepAliveTimeout = Number(m[1]) * 1000
keepAliveTimeout = keepAliveTimeout > 2000 ? keepAliveTimeout - 1000 : keepAliveTimeout / 2
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We do 1s as to take into account bad rounding from ms to s on server side.

Copy link
Member

@mcollina mcollina left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm. I'm not 100% conviced about this, as keeping it alive for a long time is typically worthwhile.

@ronag
Copy link
Member Author

ronag commented Jul 30, 2020

lgtm. I'm not 100% conviced about this, as keeping it alive for a long time is typically worthwhile.

Not convinced either... but not sure what the alternative is... both Node and Cloudfront seem to have quite short keep alive times.

@mcollina
Copy link
Member

Let's go for it

@ronag ronag merged commit 9b04995 into master Jul 30, 2020
@ronag ronag deleted the idle-timeout-default branch July 30, 2020 16:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Reduce default idle timeout?
2 participants