git-next/src/server/actors/repo/status.rs

30 lines
837 B
Rust
Raw Normal View History

use actix::prelude::*;
use gix::trace::warn;
use tracing::info;
use crate::server::{actors::repo::ValidateRepo, gitforge};
use super::AdvanceMainTo;
pub async fn check_next(
next: gitforge::Commit,
addr: Addr<super::RepoActor>,
forge: gitforge::Forge,
) {
// get the status - pass, fail, pending (all others map to fail, e.g. error)
let status = forge.commit_status(&next).await;
2024-04-12 17:41:09 +01:00
info!(?status, "Checking next branch");
match status {
gitforge::CommitStatus::Pass => {
addr.do_send(AdvanceMainTo(next));
}
gitforge::CommitStatus::Pending => {
tokio::time::sleep(tokio::time::Duration::from_secs(10)).await;
addr.do_send(ValidateRepo);
}
gitforge::CommitStatus::Fail => {
warn!("Checks have failed");
}
}
}