use std::time::Duration;
#[derive(Debug, Clone)]
pub struct SchedulerConfig {
pub poll_interval: Duration,
pub max_concurrent_tasks: usize,
pub default_max_retries: u32,
pub default_timeout_secs: u64,
}
impl Default for SchedulerConfig {
fn default() -> Self {
Self {
poll_interval: Duration::from_secs(1),
max_concurrent_tasks: 10,
default_max_retries: 3,
default_timeout_secs: 300,
}
}
}
impl SchedulerConfig {
pub fn new() -> Self {
Self::default()
}
pub fn with_poll_interval(mut self, interval: Duration) -> Self {
self.poll_interval = interval;
self
}
pub fn with_max_concurrent_tasks(mut self, max: usize) -> Self {
self.max_concurrent_tasks = max;
self
}
pub fn with_default_max_retries(mut self, retries: u32) -> Self {
self.default_max_retries = retries;
self
}
pub fn with_default_timeout_secs(mut self, timeout: u64) -> Self {
self.default_timeout_secs = timeout;
self
}
}