perago.restart_backoff_seconds#
- perago.restart_backoff_seconds(restart_count)[源代码]#
Return the supervisor restart delay for a child process.
The sequence is intentionally short and bounded so a crashing child backs off without permanently stopping the supervisor. Counts beyond the explicit sequence use the maximum delay.
- Parameters:
- restart_countint
Zero-based number of previous restarts for the child slot.
- Returns:
- int
Delay in seconds before the supervisor starts the replacement process.
- Raises:
- ValueError
If
restart_countis negative.
- 参数:
restart_count (int)
- 返回类型:
参见
worker_child_specsBuild stable child slots that reuse this backoff.
WorkerChildSpecPer-slot child specification restarted by the supervisor.
Examples
>>> [restart_backoff_seconds(index) for index in range(7)] [1, 2, 4, 8, 16, 30, 30]