mirror of
https://git.asonix.dog/asonix/background-jobs.git
synced 2024-11-24 21:11:03 +00:00
jobs-actix: use configured heartbeat interval
This commit is contained in:
parent
e2e784f012
commit
5e25b2f11d
1 changed files with 5 additions and 1 deletions
|
@ -55,8 +55,10 @@ async fn heartbeat_job<F: Future>(
|
||||||
future: F,
|
future: F,
|
||||||
job_id: Uuid,
|
job_id: Uuid,
|
||||||
runner_id: Uuid,
|
runner_id: Uuid,
|
||||||
|
heartbeat_interval: u64,
|
||||||
) -> F::Output {
|
) -> F::Output {
|
||||||
let mut interval = actix_rt::time::interval(std::time::Duration::from_secs(5));
|
let mut interval =
|
||||||
|
actix_rt::time::interval(std::time::Duration::from_millis(heartbeat_interval));
|
||||||
|
|
||||||
let mut future = std::pin::pin!(future);
|
let mut future = std::pin::pin!(future);
|
||||||
|
|
||||||
|
@ -173,6 +175,7 @@ pub(crate) async fn local_worker<State, Extras>(
|
||||||
|
|
||||||
let process_span = make_span(id, &queue, "process");
|
let process_span = make_span(id, &queue, "process");
|
||||||
let job_id = job.id;
|
let job_id = job.id;
|
||||||
|
let heartbeat_interval = job.heartbeat_interval;
|
||||||
let return_job = process_span
|
let return_job = process_span
|
||||||
.in_scope(|| {
|
.in_scope(|| {
|
||||||
heartbeat_job(
|
heartbeat_job(
|
||||||
|
@ -180,6 +183,7 @@ pub(crate) async fn local_worker<State, Extras>(
|
||||||
time_job(processors.process(job), job_id),
|
time_job(processors.process(job), job_id),
|
||||||
job_id,
|
job_id,
|
||||||
id,
|
id,
|
||||||
|
heartbeat_interval,
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
.instrument(process_span)
|
.instrument(process_span)
|
||||||
|
|
Loading…
Reference in a new issue