From b6725dceca72772cbb3948936ae809e38daef69d Mon Sep 17 00:00:00 2001 From: Ruben Fiszel Date: Sun, 4 Sep 2022 13:05:39 +0200 Subject: [PATCH] use local time for timeout --- backend/src/worker.rs | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/backend/src/worker.rs b/backend/src/worker.rs index ee0cdb82ea..a9330997c8 100644 --- a/backend/src/worker.rs +++ b/backend/src/worker.rs @@ -1073,6 +1073,7 @@ async fn handle_child( let mut start = logs.chars().count(); let mut last_update = chrono::Utc::now().timestamp_millis(); + let initial_start = chrono::Utc::now(); while !done.load(Ordering::Relaxed) { let diff = 500 - (chrono::Utc::now().timestamp_millis() - last_update); @@ -1104,10 +1105,7 @@ async fn handle_child( done.store(true, Ordering::Relaxed); } - let has_timeout = job - .started_at - .map(|sa| (chrono::Utc::now() - sa).num_seconds() > timeout as i64) - .unwrap_or(false); + let has_timeout = (chrono::Utc::now() - initial_start).num_seconds() > timeout as i64; if has_timeout { let q = sqlx::query(&format!(