diff --git a/src/api_client.rs b/src/api_client.rs index 40a2e256..809a984c 100644 --- a/src/api_client.rs +++ b/src/api_client.rs @@ -118,9 +118,10 @@ pub struct FetchLocalRunReportHeadReport { #[derive(Deserialize, Serialize, Debug, Clone, PartialEq)] #[serde(rename_all = "SCREAMING_SNAKE_CASE")] pub enum RunStatus { + Completed, + Failure, Pending, Processing, - Completed, } #[derive(Debug, Deserialize, Serialize)] #[serde(rename_all = "camelCase")] diff --git a/src/run/poll_results.rs b/src/run/poll_results.rs index 44abedd0..73be7936 100644 --- a/src/run/poll_results.rs +++ b/src/run/poll_results.rs @@ -39,7 +39,9 @@ pub async fn poll_results( .fetch_local_run_report(fetch_local_run_report_vars.clone()) .await? { - FetchLocalRunReportResponse { run, .. } if run.status != RunStatus::Completed => { + FetchLocalRunReportResponse { run, .. } + if run.status == RunStatus::Pending || run.status == RunStatus::Processing => + { sleep(POLLING_INTERVAL).await; } response_from_api => { @@ -49,6 +51,10 @@ pub async fn poll_results( } } + if response.run.status == RunStatus::Failure { + bail!("Run failed to be processed, try again in a few minutes"); + } + let report = response .run .head_reports