You've already forked decomp.dev
mirror of
https://github.com/encounter/decomp.dev.git
synced 2026-07-10 03:18:48 -07:00
Add Apalis job timeout (15m)
This commit is contained in:
@@ -61,10 +61,20 @@ pub struct WorkerConfig {
|
||||
pub refresh_project_concurrency: usize,
|
||||
/// Number of retry attempts for failed jobs.
|
||||
pub retry_attempts: usize,
|
||||
/// Maximum wall-clock seconds allowed for a single job attempt.
|
||||
#[serde(default = "default_job_timeout_secs")]
|
||||
pub job_timeout_secs: u64,
|
||||
}
|
||||
|
||||
impl Default for WorkerConfig {
|
||||
fn default() -> Self {
|
||||
Self { workflow_run_concurrency: 3, refresh_project_concurrency: 3, retry_attempts: 5 }
|
||||
Self {
|
||||
workflow_run_concurrency: 3,
|
||||
refresh_project_concurrency: 3,
|
||||
retry_attempts: 5,
|
||||
job_timeout_secs: default_job_timeout_secs(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn default_job_timeout_secs() -> u64 { 15 * 60 }
|
||||
|
||||
@@ -86,8 +86,13 @@ pub fn create_monitor(
|
||||
context: JobContext,
|
||||
config: &WorkerConfig,
|
||||
) -> Monitor {
|
||||
let &WorkerConfig { workflow_run_concurrency, refresh_project_concurrency, retry_attempts } =
|
||||
config;
|
||||
let &WorkerConfig {
|
||||
workflow_run_concurrency,
|
||||
refresh_project_concurrency,
|
||||
retry_attempts,
|
||||
job_timeout_secs,
|
||||
} = config;
|
||||
let job_timeout = Duration::from_secs(job_timeout_secs);
|
||||
|
||||
let backoff = ExponentialBackoffMaker::new(
|
||||
Duration::from_secs(1),
|
||||
@@ -112,6 +117,7 @@ pub fn create_monitor(
|
||||
.register(move |_| {
|
||||
WorkerBuilder::new("workflow-run-worker")
|
||||
.backend(storage1.workflow_run.clone())
|
||||
.timeout(job_timeout)
|
||||
.retry(retry1.clone())
|
||||
.enable_tracing()
|
||||
.catch_panic()
|
||||
@@ -128,6 +134,7 @@ pub fn create_monitor(
|
||||
.register(move |_| {
|
||||
WorkerBuilder::new("refresh-project-worker")
|
||||
.backend(storage2.refresh_project.clone())
|
||||
.timeout(job_timeout)
|
||||
.retry(retry2.clone())
|
||||
.enable_tracing()
|
||||
.catch_panic()
|
||||
|
||||
Reference in New Issue
Block a user