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

34 lines
948 B
Rust

//
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;
let _ = actor::send(
addr,
actor::messages::ReceiveCIStatus::new((next, status)),
&log,
)
.await;
}
.in_current_span()
.into_actor(self)
.wait(ctx);
}
}