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

By default set client idle timeout #2371

Merged
merged 1 commit into from
Aug 12, 2023

Conversation

erikvanoosten
Copy link
Contributor

@erikvanoosten erikvanoosten commented Aug 6, 2023

Having no idle timeout by default is not the right choice. Most modern environments (e.g. every cloud, every proxy) forget about idle connections fairly quickly. For example, I have worked with proxies that forgot about connections after an idle time of as low as 90 seconds.

Having to find this out in production is not a good developer experience.

In this change we set the default idle time to 50 seconds.

Having no idle timeout by default is not the right choice. Most modern environments (e.g. every cloud, every proxy) forget about idle connections fairly quickly. For example, I have worked with proxies that forgot about connections after an idle time of as low as 90 seconds.

In this change we set the default idle time to 50 seconds.
@codecov-commenter
Copy link

codecov-commenter commented Aug 6, 2023

Codecov Report

Patch and project coverage have no change.

Comparison is base (cdafab7) 63.24% compared to head (32d2a4f) 63.24%.

❗ Your organization is not using the GitHub App Integration. As a result you may experience degraded service beginning May 15th. Please install the Github App Integration for your organization. Read more.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #2371   +/-   ##
=======================================
  Coverage   63.24%   63.24%           
=======================================
  Files         136      136           
  Lines        7046     7046           
  Branches     1219     1219           
=======================================
  Hits         4456     4456           
  Misses       2590     2590           
Files Changed Coverage Δ
zio-http/src/main/scala/zio/http/ZClient.scala 42.75% <ø> (ø)

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@@ -608,7 +608,7 @@ object ZClient {
localAddress = None,
addUserAgentHeader = true,
webSocketConfig = WebSocketConfig.default,
idleTimeout = None,
idleTimeout = Some(50.seconds),
Copy link
Member

Choose a reason for hiding this comment

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

Why 50 and not 60?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Just in case a virtual network or proxy decides to set the idle time out to 60 seconds, we need something even lower than that. On the other hand, it should be as high as possible. 50 is a random compromise I picked.

@vigoo vigoo merged commit 58e5284 into zio:main Aug 12, 2023
@erikvanoosten erikvanoosten deleted the default-idle-timeout branch August 12, 2023 07:35
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.

4 participants