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 deprecated IdleTimeout config #2143

Merged
merged 3 commits into from
Sep 20, 2017

Conversation

m3co-code
Copy link
Contributor

@m3co-code m3co-code commented Sep 19, 2017

This PR fixes loading of the deprecated top-level option IdleTimeout. Also, it changes the semantics so that the deprecated option is now preferred and a warning is logged when it is used.

All the different configuration constellations I also verified via the matching CLI parameters as well.

I tried the following configs and they deliver now the expected results:

# default config, nothing specified

-> default timeout of 30 seconds is used

# only deprecated option specified
idleTimeout="42s"

-> deprecated option of 42 seconds is used

# deprecated option with RespondingTimeouts "activated"
idleTimeout="42s"
[respondingTimeouts]

-> deprecated option of 42 seconds is used

# deprecated option and new option specified
idleTimeout="42s"
[respondingTimeouts]
  idleTimeout="23s"

-> deprecated option of 42 seconds is used

# deprecated option *other* new option specified
idleTimeout="42s"
[respondingTimeouts]
  readTimeout="23s"

-> deprecated option of 42 seconds is used

# only new option specified
[respondingTimeouts]
  idleTimeout="23s"

-> new option of 23 seconds is used

While working on this PR I realized that also the health check has "problems" with its default interval, given it is configured in the following way (imho no one would do such a thing, but still...). As this was at related code places as my change I decided to include it in this PR:

[healthcheck]

[backends]
  [backends.backend1]
    [backends.backend1.healthCheck]
    path="/health"
    [backends.backend1.servers.server1]
    url = "http://localhost:8081"

-> interval is initialised with 0 and will lead to Error in Go routine: non-positive interval for NewTicker

Before the --idletimeout or top level idleTimeout setting in the TOML
was not respected anymore and not used. This PR fixes this.

Also it changes the semantics so that the legacy option is preferred
while issuing a warning about the deprecation when its used.
in order to align the process with RespondingTimeouts.
when no interval is specified but the health check is activated via the
config.
@m3co-code
Copy link
Contributor Author

@timoreimann as you were also involved in this, do you want to have a look? :)

@timoreimann
Copy link
Contributor

timoreimann commented Sep 19, 2017

Just to be super sure, I'd also test this kind of case:

# deprecated option *other* new option specified
idleTimeout="42s"
[respondingTimeouts]
  readTimeout="23s"

This should cause an effective idle timeout of 42 seconds to be applied.

@m3co-code
Copy link
Contributor Author

Thanks for the note Timo. I verified it successfully and added it in my PR description above.

Copy link
Contributor

@nmengin nmengin left a comment

Choose a reason for hiding this comment

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

LGTM 👏

Copy link
Contributor

@ldez ldez left a comment

Choose a reason for hiding this comment

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

LGTM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants