From 83ce95776e96639bfce09f5a6342f5d27eb0e8c6 Mon Sep 17 00:00:00 2001 From: Paul Campbell Date: Tue, 2 Jul 2024 18:51:40 +0100 Subject: [PATCH] fix: messages should always get delivered Remove the async wrapper for sending messages as they were never being delivered. --- crates/repo-actor/src/handlers/check_ci_status.rs | 6 +++--- crates/repo-actor/src/handlers/validate_repo.rs | 5 ++--- crates/repo-actor/src/lib.rs | 15 --------------- 3 files changed, 5 insertions(+), 21 deletions(-) diff --git a/crates/repo-actor/src/handlers/check_ci_status.rs b/crates/repo-actor/src/handlers/check_ci_status.rs index 264b93d4..fc696863 100644 --- a/crates/repo-actor/src/handlers/check_ci_status.rs +++ b/crates/repo-actor/src/handlers/check_ci_status.rs @@ -20,12 +20,12 @@ impl Handler for actor::RepoActor { // 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( + tracing::debug!("got status: {status:?}"); + actor::do_send( addr, actor::messages::ReceiveCIStatus::new((next, status)), &log, - ) - .await; + ); } .in_current_span() .into_actor(self) diff --git a/crates/repo-actor/src/handlers/validate_repo.rs b/crates/repo-actor/src/handlers/validate_repo.rs index f0de5f6e..e085bf73 100644 --- a/crates/repo-actor/src/handlers/validate_repo.rs +++ b/crates/repo-actor/src/handlers/validate_repo.rs @@ -87,12 +87,11 @@ impl Handler for actor::RepoActor { actor::logger(&log, "before sleep"); tokio::time::sleep(sleep_duration).await; actor::logger(&log, "after sleep"); - let _ = actor::send( + actor::do_send( addr, actor::messages::ValidateRepo::new(message_token), &log, - ) - .await; + ); } .in_current_span() .into_actor(self) diff --git a/crates/repo-actor/src/lib.rs b/crates/repo-actor/src/lib.rs index 7f218f54..a06082cd 100644 --- a/crates/repo-actor/src/lib.rs +++ b/crates/repo-actor/src/lib.rs @@ -116,21 +116,6 @@ where _addr.do_send(msg) } -pub async fn send( - addr: Addr, - msg: M, - log: &Option, -) -> std::result::Result<::Result, actix::MailboxError> -where - M: actix::Message + Send + 'static + std::fmt::Debug, - RepoActor: actix::Handler, - ::Result: Send, -{ - let log_message = format!("send: {:?}", msg); - logger(log, log_message); - addr.send(msg).await -} - pub fn logger(log: &Option, message: impl Into) { if let Some(log) = log { let message: String = message.into();