From 1d20e031f8e4a595dd9c7880e5453796e3480dd2 Mon Sep 17 00:00:00 2001 From: Adrien Cacciaguerra Date: Wed, 10 Jul 2024 08:29:41 +0200 Subject: [PATCH] feat(runner/poll_results): poll every second --- src/run/poll_results.rs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/run/poll_results.rs b/src/run/poll_results.rs index a17b789..d09dbe7 100644 --- a/src/run/poll_results.rs +++ b/src/run/poll_results.rs @@ -13,6 +13,7 @@ use super::ci_provider::CIProvider; use super::config::Config; const RUN_PROCESSING_MAX_DURATION: Duration = Duration::from_secs(60 * 5); // 5 minutes +const POLLING_INTERVAL: Duration = Duration::from_secs(1); #[allow(clippy::borrowed_box)] pub async fn poll_results( @@ -42,10 +43,10 @@ pub async fn poll_results( .await? { FetchLocalRunReportResponse { run, .. } if run.status != RunStatus::Completed => { - sleep(Duration::from_secs(5)).await; + sleep(POLLING_INTERVAL).await; } - reponse_from_api => { - response = reponse_from_api; + response_from_api => { + response = response_from_api; break; } }