config: change ServiceConfig.concurrency_limit default to 4
Signed-off-by: NotAShelf <raf@notashelf.dev> Change-Id: I922cd160b642faaa1218b5f1dd89a53f6a6a6964
This commit is contained in:
parent
f51e659209
commit
abd29e0969
1 changed files with 46 additions and 1 deletions
|
|
@ -100,10 +100,55 @@ pub struct ServiceConfig {
|
||||||
pub concurrency_limit: usize,
|
pub concurrency_limit: usize,
|
||||||
pub temp_dir: String,
|
pub temp_dir: String,
|
||||||
pub state_db_path: String,
|
pub state_db_path: String,
|
||||||
|
#[serde(default)]
|
||||||
|
pub retry: RetryConfig,
|
||||||
}
|
}
|
||||||
|
|
||||||
const fn default_concurrency_limit() -> usize {
|
const fn default_concurrency_limit() -> usize {
|
||||||
10
|
4
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||||
|
pub struct RetryConfig {
|
||||||
|
/// Maximum number of retry attempts before giving up.
|
||||||
|
#[serde(default = "default_max_retries")]
|
||||||
|
pub max_retries: u32,
|
||||||
|
/// Initial backoff duration in milliseconds before the first retry.
|
||||||
|
#[serde(default = "default_initial_backoff_ms")]
|
||||||
|
pub initial_backoff_ms: u64,
|
||||||
|
/// Multiplier applied to the backoff on each successive retry.
|
||||||
|
#[serde(default = "default_backoff_multiplier")]
|
||||||
|
pub backoff_multiplier: f64,
|
||||||
|
/// Maximum backoff duration in milliseconds, capping exponential growth.
|
||||||
|
#[serde(default = "default_max_backoff_ms")]
|
||||||
|
pub max_backoff_ms: u64,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Default for RetryConfig {
|
||||||
|
fn default() -> Self {
|
||||||
|
Self {
|
||||||
|
max_retries: default_max_retries(),
|
||||||
|
initial_backoff_ms: default_initial_backoff_ms(),
|
||||||
|
backoff_multiplier: default_backoff_multiplier(),
|
||||||
|
max_backoff_ms: default_max_backoff_ms(),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const fn default_max_retries() -> u32 {
|
||||||
|
3
|
||||||
|
}
|
||||||
|
|
||||||
|
const fn default_initial_backoff_ms() -> u64 {
|
||||||
|
500
|
||||||
|
}
|
||||||
|
|
||||||
|
const fn default_backoff_multiplier() -> f64 {
|
||||||
|
2.0
|
||||||
|
}
|
||||||
|
|
||||||
|
const fn default_max_backoff_ms() -> u64 {
|
||||||
|
30_000
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue