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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
// Copyright (c) 2026 Super Durable, Inc.
//
// Licensed under the Sustainable Use License 1.0.
// You may not use this file except in compliance with the License.
// See the LICENSE file in the repository root.
//
// SPDX-License-Identifier: LicenseRef-Sustainable-Use-1.0
use Duration;
/// Overrides Dex retry timing for a Flow, `wait_for`, or `execute` operation.
///
/// Unset fields use server defaults. Intervals and total duration use [`Duration`]; maximum
/// attempts counts the initial attempt. A zero maximum attempts value uses the server behavior.
///
/// Step retries default to a one-second initial interval, a multiplier of 2, a 100-second
/// maximum interval, unlimited attempts, and four hours of total duration. Zero values select
/// those defaults. A maximum of one disables retries. Non-retryable handler failures do not retry.
///
/// Changed in 1.35.0: a Step's total duration starts at its first hand-out to a Worker.
/// It only gates scheduling another retry after failure; it never interrupts a running attempt.
/// Method and heartbeat timeouts still apply to that attempt. Initial queue and lock waits do
/// not consume the budget. Later backoff and queue waits do. A scheduled retry can start after
/// the budget expires. Gracefully returning attempt one resets the budget's start only when no
/// execution of that attempt may have run.
///
/// Use this policy for Step methods. The Server does not support whole-Flow retry. It rejects
/// [`crate::StartFlowOptions::retry_policy`] with INVALID_ARGUMENT and rejects a SubFlow that
/// sets [`crate::SubFlowOptions::retry_policy`] as invalid input. Use Step retry policies instead.
/// Duration values must fit signed 32-bit whole seconds when submitted. Builders take ownership
/// and return the updated policy; validation occurs when the options are mapped for a request.
///
/// # Examples
///
/// ```
/// use dex_sdk::RetryPolicy;
/// use std::time::Duration;
///
/// let retry = RetryPolicy::new()
/// .initial_interval(Duration::from_secs(1))
/// .backoff_coefficient(2.0)
/// .maximum_interval(Duration::from_secs(30))
/// .maximum_attempts(5);
/// ```