feat: add SchedulerConfig to GatewayConfig
This commit is contained in:
parent
46527edb7b
commit
75b8f7b8a5
@ -140,6 +140,43 @@ pub struct GatewayConfig {
|
|||||||
pub cleanup_interval_minutes: Option<u64>,
|
pub cleanup_interval_minutes: Option<u64>,
|
||||||
#[serde(default, rename = "session_db_path")]
|
#[serde(default, rename = "session_db_path")]
|
||||||
pub session_db_path: Option<String>,
|
pub session_db_path: Option<String>,
|
||||||
|
#[serde(default)]
|
||||||
|
pub scheduler: Option<SchedulerConfig>,
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||||
|
pub struct SchedulerConfig {
|
||||||
|
/// Whether the scheduler is enabled
|
||||||
|
#[serde(default = "default_scheduler_enabled")]
|
||||||
|
pub enabled: bool,
|
||||||
|
/// Poll interval in seconds (how often to check for due jobs)
|
||||||
|
#[serde(default = "default_poll_interval_secs")]
|
||||||
|
pub poll_interval_secs: u64,
|
||||||
|
/// Maximum concurrent job executions (currently sequential, reserved for future)
|
||||||
|
#[serde(default = "default_max_concurrent")]
|
||||||
|
pub max_concurrent: usize,
|
||||||
|
}
|
||||||
|
|
||||||
|
fn default_scheduler_enabled() -> bool {
|
||||||
|
true
|
||||||
|
}
|
||||||
|
|
||||||
|
fn default_poll_interval_secs() -> u64 {
|
||||||
|
60
|
||||||
|
}
|
||||||
|
|
||||||
|
fn default_max_concurrent() -> usize {
|
||||||
|
1
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Default for SchedulerConfig {
|
||||||
|
fn default() -> Self {
|
||||||
|
Self {
|
||||||
|
enabled: true,
|
||||||
|
poll_interval_secs: 60,
|
||||||
|
max_concurrent: 1,
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Clone, Deserialize, Serialize)]
|
#[derive(Debug, Clone, Deserialize, Serialize)]
|
||||||
@ -168,6 +205,7 @@ impl Default for GatewayConfig {
|
|||||||
session_ttl_hours: None,
|
session_ttl_hours: None,
|
||||||
cleanup_interval_minutes: None,
|
cleanup_interval_minutes: None,
|
||||||
session_db_path: None,
|
session_db_path: None,
|
||||||
|
scheduler: None,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user