Skip to main content

Module recovery_delay

Module recovery_delay 

Source
Expand description

Random delay before each launch-time kill recovery (issue #181):

--on-kill-resume-delay <min[-max]>   seconds; one number is a fixed delay,
                                     0 (the default) resumes at once

One host-wide OOM event can kill several detached docker executions at the same moment. Without a delay every watcher resumes its container in the same second, all of them rebuild their working sets at once, and the next OOM event follows. A uniformly random delay spreads the recoveries out.

Structs§

RecoveryDelayRange
A delay range in seconds.

Constants§

CANCEL_CHECK_INTERVAL_MS
How often a pending recovery checks whether a stop was requested.

Functions§

effective_on_kill_resume_delay
The normalized non-zero delay range, or None when there is no delay.
format_recovery_delay
42s, 42.5s.
format_recovery_delay_range
30-90 for a range, 45 for a fixed delay.
parse_on_kill_resume_delay_value
Validate and normalize the --on-kill-resume-delay argument.
parse_recovery_delay_range
Parse 30-90, 45 or 0; None when malformed or max < min.
pick_recovery_delay_ms
Pick a uniformly random delay in whole milliseconds; 0 without a range.
record_on_kill_resume_delay
The delay range stored in a record option (a string, or a number when the record codec turned 45 into one).
system_random
A uniformly random number in [0, 1) from the OS random source behind uuid v4, so no extra dependency is needed.
system_sleep
Block the current thread.
wait_for_recovery_delay
Wait out the delay in short steps, giving up as soon as should_cancel returns true (a --stop during the wait). Returns true when cancelled.