git-next/crates/repo-actor/src/handlers/check_ci_status.rs
Paul Campbell 83ce95776e fix: messages should always get delivered
Remove the async wrapper for sending messages as they were never being
delivered.
2024-07-02 18:51:40 +01:00

34 lines
979 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;
tracing::debug!("got status: {status:?}");
actor::do_send(
addr,
actor::messages::ReceiveCIStatus::new((next, status)),
&log,
);
}
.in_current_span()
.into_actor(self)
.wait(ctx);
}
}