-
Notifications
You must be signed in to change notification settings - Fork 5.6k
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
feat(config): Accept durations given in days (e.g. "7d") #12579
Conversation
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.
I have mixed feelings on this.
On one hand, I acknowledge that it is nice for some config options. On the other hand it has never worked before now, we produce an error currently, and it is not a valid option with time.Duration
and I do not like having two different behaviors.
I will approve, but just note the above.
edit: I restarted mac test as it seemed to have timed out.
Download PR build artifacts for linux_amd64.tar.gz, darwin_amd64.tar.gz, and windows_amd64.zip. 📦 Click here to get additional PR build artifactsArtifact URLs |
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.
I think this could be much simpler by using fmt.Scanf
?
On one hand, I acknowledge that it is nice for some config options. On the other hand it has never worked before now, we produce an error currently, and it is not a valid option with
time.Duration
and I do not like having two different behaviors.
It was discussed on the maintainers meeting of 2022-12-20. Granted, you weren't there, but my idea was to support this for now, but with a deprecation warning given the following facts:
- Never worked, started to give errors in 1.22.0 (May 2022)
- Suggested as default value (
0d
) until 1.22.1 (April 2022)
So my idea is to remove this 'functionality' again after the deprecation and moving to new version with breaking changes..
"3d7d", | ||
"15m8h3.5d" |
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.
I don't think these formats should be supported?
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.
Why? Golang's ParseDuration
supports them, so why shouldn't we?
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.
It makes it more complex and was only intended to be a temporary workaround.. Or do you think differently?
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.
Yes I do think differently as I do not think this is in any way more complex than the other features. If the code change is too complex in your view, we should completely drop the feature as it won't become any simpler...
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.
Okay, never mind then.
But do add depreciation warnings.
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 aren't we going to deprecate it?
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.
I do not see what we do deprecate.... 0d
is explicitly supported in the code and the remaining never worked. So either we add this or leave the stuff with an (overdue) error...
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.
The whole idea was initially to support it, but immediately deprecate it so it can be removed in next major version.
Its fine for me to not deprecate it and keep it working, but then the docs need to be updated.
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.
Please update documentation or add deprecation warning.
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.
So in the past, duration with days would not error, but effectively would not be applied. I made duration with days an error, a few releases ago. This PR would allow them to actually work. I do not see us adding support and then immediately deprecating something that is already throwing an error.
Approving this and adding it is effectively a new feature to allow day based timestamps, and while it is not officially supported upstream is a convienince thing.
@powersj you merged, but documentation is still not updated.. |
This PR allows to specify duration in days. This is e.g. helpful for logfile rotation or other long-running tasks or intervals.