git-next/crates/repo-actor/src/handlers/check_ci_status.rs

35 lines
979 B
Rust
Raw Normal View History

//
use crate as actor;
use actix::prelude::*;
use tracing::Instrument as _;
impl Handler<actor::messages::CheckCIStatus> for actor::RepoActor {
type Result = ();
fn handle(
&mut self,
msg: actor::messages::CheckCIStatus,
ctx: &mut Self::Context,
) -> Self::Result {
actor::logger(&self.log, "start: CheckCIStatus");
let addr = ctx.address();
let forge = self.forge.duplicate();
let next = msg.unwrap();
let log = self.log.clone();
// get the status - pass, fail, pending (all others map to fail, e.g. error)
async move {
let status = forge.commit_status(&next).await;
tracing::debug!("got status: {status:?}");
actor::do_send(
addr,
actor::messages::ReceiveCIStatus::new((next, status)),
&log,
);
}
.in_current_span()
.into_actor(self)
.wait(ctx);
}
}