Interpret value of kill_delay as milliseconds #462
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
kill_delay
is parsed as a Duration (ref). When given as an integer (as in the example config), it is interpreted as nanoseconds, not milliseconds. The sleep will be too short to allow a program to respond to the interrupt and stop cleanly. This change allows the number to be interpreted as milliseconds.This change is made to preserve backwards compatibility. If the value is specified as an value under 1 millisecond/1 000 000 nanoseconds, like
500
in the example config, the value will be interpreted as the number of milliseconds. For users who figured out that you may specify the time as a duration string like”2s”
or use large nanosecond integers like2000000000
for 2 seconds, the behavior will remain the same.An alternative is changing
kill_delay
to be parsed as an integer, likedelay
andrerun_delay
. This will break users who used duration strings or large numbers.This may be the root cause of the problem reported in #216, as a sufficient value for
kill_delay
to allow a program to stop gracefully solved this problem for me.