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

29 lines
837 B
Rust

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;
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");
}
}
}