homestar_runtime/workflow/
settings.rs

1//! [Workflow] settings for a worker's run/execution.
2//!
3//! [Workflow]: homestar_workflow::Workflow
4
5use std::time::Duration;
6
7/// Workflow settings.
8#[derive(Debug, Clone, PartialEq)]
9pub struct Settings {
10    /// Number of retries for a given workflow.
11    pub(crate) retries: u32,
12    /// Maximum delay between retries.
13    pub(crate) retry_max_delay: Duration,
14    /// Initial delay between retries.
15    pub(crate) retry_initial_delay: Duration,
16    /// Timeout for a given workflow.
17    pub(crate) timeout: Duration,
18}
19
20#[cfg(all(not(test), not(feature = "test-utils")))]
21impl Default for Settings {
22    fn default() -> Self {
23        Self {
24            retries: 3,
25            retry_max_delay: Duration::new(60, 0),
26            retry_initial_delay: Duration::from_millis(500),
27            timeout: Duration::new(3600, 0),
28        }
29    }
30}
31
32#[cfg(any(test, feature = "test-utils"))]
33#[cfg_attr(docsrs, doc(cfg(feature = "test-utils")))]
34impl Default for Settings {
35    fn default() -> Self {
36        Self {
37            retries: 0,
38            retry_max_delay: Duration::new(1, 0),
39            retry_initial_delay: Duration::from_millis(50),
40            timeout: Duration::from_secs(3600),
41        }
42    }
43}