#[non_exhaustive]pub struct JobConfig {
pub poll_interval_secs: u64,
pub stale_threshold_secs: u64,
pub stale_reaper_interval_secs: u64,
pub drain_timeout_secs: u64,
pub queues: Vec<QueueConfig>,
pub cleanup: Option<CleanupConfig>,
pub database: Option<Config>,
}Expand description
Top-level configuration for the job worker.
Deserializes from YAML under the job key. All fields have defaults so an
empty config block is valid.
§Defaults
| Field | Default |
|---|---|
poll_interval_secs | 1 |
stale_threshold_secs | 600 (10 min) |
stale_reaper_interval_secs | 60 (1 min) |
drain_timeout_secs | 30 |
queues | one "default" queue with concurrency 4 |
cleanup | enabled, 1 h interval, 72 h retention |
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.poll_interval_secs: u64How often the worker polls the database for new jobs, in seconds.
stale_threshold_secs: u64Jobs stuck in running for longer than this many seconds are considered
stale and reset to pending by the reaper.
stale_reaper_interval_secs: u64How often the stale reaper runs, in seconds.
drain_timeout_secs: u64Maximum time in seconds to wait for in-flight jobs to finish during graceful shutdown.
queues: Vec<QueueConfig>Queue definitions. Defaults to a single "default" queue.
cleanup: Option<CleanupConfig>Optional periodic cleanup of terminal jobs. Set to None to disable.
database: Option<Config>Separate SQLite database for the job queue. When set, the job worker uses this pool instead of the main application database, keeping job-queue writes from contending with app queries.