1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
//! # Retry and restart policies.
//!
//! This module contains the policy types that control task restarts.
//!
//! | Type | Role |
//! |-------------------|--------------------------------------------------------|
//! | [`RestartPolicy`] | Decides if a task starts again after success or failure |
//! | [`BackoffPolicy`] | Computes retry delay after a retryable failure |
//! | [`JitterPolicy`] | Adds random spread to retry delays |
//! | [`BackoffError`] | Error returned by invalid backoff settings |
//!
//! ## Flow
//!
//! [`TaskSpec`](crate::TaskSpec) stores one [`RestartPolicy`] and one [`BackoffPolicy`].
//! [`BackoffPolicy`] stores the [`JitterPolicy`] used for retry delays.
//!
//! ```text
//! RestartPolicy ─┐
//! ├──► TaskSpec ──► Supervisor
//! BackoffPolicy ─┘
//! └── JitterPolicy
//! ```
//!
//! ## Defaults
//!
//! - [`RestartPolicy::OnFailure`] - restart only after retryable failures.
//! - [`BackoffPolicy::default()`] - constant `100ms` retry delay, capped at `30s`.
//! - [`JitterPolicy::None`] - no random delay by default.
//!
//! For balanced retry spreading, use [`JitterPolicy::Equal`].
pub use ;
pub use RestartPolicy;
pub use JitterPolicy;