Skip to content

Commit 688ccff

Browse files
authored
Merge pull request #147 from ltratt/reset_timer_for_errorcmd
Reset the timer before running `errorcmd`.
2 parents bb11494 + a403235 commit 688ccff

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

src/jobrunner.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -264,9 +264,18 @@ impl JobRunner {
264264
} else if let Some(errorchild) =
265265
self.run_errorcmd(job, exit_type, &exit_code)
266266
{
267+
// The main command might have exceeded the timeout, so if we run
268+
// `errorcmd` it might immediately be killed. Reset the timer to
269+
// ensure `errorcmd` has time to run.
270+
let finish_by = Instant::now()
271+
.checked_add(Duration::from_millis(
272+
job.rconf.timeout.saturating_mul(1000),
273+
))
274+
.unwrap();
267275
let job = &mut self.running[i].as_mut().unwrap();
268276
job.child = errorchild;
269277
job.is_errorcmd = true;
278+
job.finish_by = finish_by;
270279
continue;
271280
}
272281
}

0 commit comments

Comments
 (0)