-
-
Notifications
You must be signed in to change notification settings - Fork 5.2k
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
Use TOML-compatible duration type. #1350
Conversation
a9807a6
to
9d700f7
Compare
@containous/traefik Please review. |
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.
SGTM but this would mean ppl that have this option specified as an int 10
would need to update their configuration, right ?
No, precisely not: The custom duration type assumes second scale if you don't specify a unit. See also the description in the PR, the docs, and the source of truth. :) |
@timoreimann thanks 👼 sorry I'm not fully awake this morning it seems 😂 |
@vdemeester haha no worries. Nothing that an extra shot of caffeine can't fix. :-) |
LGTM, But I might make it clearer in the docs that not providing a unit will result in the value being parsed as seconds. Other proxies use raw values as milliseconds, so that would be a distinction worth making. |
@dtomcej I tried to document that the value defaults to seconds without a unit. Do you think it should be made clearer? If so, could you provide a better phrasing please? |
docs/toml.md
Outdated
@@ -56,11 +57,13 @@ | |||
# Backends throttle duration: minimum duration in seconds between 2 events from providers | |||
# before applying a new configuration. It avoids unnecessary reloads if multiples events | |||
# are sent in a short amount of time. | |||
# Can be provided in a format supported by [time.ParseDuration](https://golang.org/pkg/time/#ParseDuration) or as digits | |||
# only. In the latter case, seconds are assumed. |
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.
or as digits only
-> or as raw values (digits)
In the latter case, seconds are assumed.
-> If no units are provided, the value is parsed assuming seconds.
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.
@dtomcej Updated the docs.
0b3dfdd
to
43ad187
Compare
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.
LGTM!
Thanks @timoreimann
43ad187
to
056fe9a
Compare
This PR introduces a new
time.Duration
-based type capable of deserializing durations in TOML specs. Without providing a unit specifier, it defaults to seconds for backwards compatibility reasons and the fact that most of our duration specifiers are at the order of seconds.TODO: SwitchDone.glide.yaml
back to github.com/containous/flaeg once containous/flaeg#34 merges.Fixes #1342.