platform_runtime/
retries.rs1use std::time::Duration;
2
3#[derive(Debug, Clone)]
4pub struct RetryPolicy {
5 pub max_attempts: u32,
6 pub initial_delay: Duration,
7}
8
9impl RetryPolicy {
10 pub fn none() -> Self {
11 Self {
12 max_attempts: 1,
13 initial_delay: Duration::ZERO,
14 }
15 }
16
17 pub fn fixed(max_attempts: u32, initial_delay: Duration) -> Self {
18 Self {
19 max_attempts,
20 initial_delay,
21 }
22 }
23}
24
25impl Default for RetryPolicy {
26 fn default() -> Self {
27 Self::fixed(3, Duration::from_secs(5))
28 }
29}