fix: messages should always get delivered
All checks were successful
Rust / build (push) Successful in 1m11s
ci/woodpecker/push/cron-docker-builder Pipeline was successful
ci/woodpecker/push/push-next Pipeline was successful
ci/woodpecker/push/tag-created Pipeline was successful

Remove the async wrapper for sending messages as they were never being
delivered.
This commit is contained in:
Paul Campbell 2024-07-02 18:51:40 +01:00
parent 7fdea2913a
commit 83ce95776e
3 changed files with 5 additions and 21 deletions

View file

@ -20,12 +20,12 @@ impl Handler<actor::messages::CheckCIStatus> for actor::RepoActor {
// get the status - pass, fail, pending (all others map to fail, e.g. error) // get the status - pass, fail, pending (all others map to fail, e.g. error)
async move { async move {
let status = forge.commit_status(&next).await; let status = forge.commit_status(&next).await;
let _ = actor::send( tracing::debug!("got status: {status:?}");
actor::do_send(
addr, addr,
actor::messages::ReceiveCIStatus::new((next, status)), actor::messages::ReceiveCIStatus::new((next, status)),
&log, &log,
) );
.await;
} }
.in_current_span() .in_current_span()
.into_actor(self) .into_actor(self)

View file

@ -87,12 +87,11 @@ impl Handler<actor::messages::ValidateRepo> for actor::RepoActor {
actor::logger(&log, "before sleep"); actor::logger(&log, "before sleep");
tokio::time::sleep(sleep_duration).await; tokio::time::sleep(sleep_duration).await;
actor::logger(&log, "after sleep"); actor::logger(&log, "after sleep");
let _ = actor::send( actor::do_send(
addr, addr,
actor::messages::ValidateRepo::new(message_token), actor::messages::ValidateRepo::new(message_token),
&log, &log,
) );
.await;
} }
.in_current_span() .in_current_span()
.into_actor(self) .into_actor(self)

View file

@ -116,21 +116,6 @@ where
_addr.do_send(msg) _addr.do_send(msg)
} }
pub async fn send<M>(
addr: Addr<RepoActor>,
msg: M,
log: &Option<crate::RepoActorLog>,
) -> std::result::Result<<M as actix::Message>::Result, actix::MailboxError>
where
M: actix::Message + Send + 'static + std::fmt::Debug,
RepoActor: actix::Handler<M>,
<M as actix::Message>::Result: Send,
{
let log_message = format!("send: {:?}", msg);
logger(log, log_message);
addr.send(msg).await
}
pub fn logger(log: &Option<crate::RepoActorLog>, message: impl Into<String>) { pub fn logger(log: &Option<crate::RepoActorLog>, message: impl Into<String>) {
if let Some(log) = log { if let Some(log) = log {
let message: String = message.into(); let message: String = message.into();