From 6790b54d4d6a0a0161f38320f6f85e26c58185d9 Mon Sep 17 00:00:00 2001 From: phiresky Date: Mon, 18 Dec 2023 19:17:10 +0100 Subject: [PATCH] make activity channel infallible (#4295) --- crates/api_common/src/send_activity.rs | 4 ++-- crates/apub/src/activities/mod.rs | 7 ++++--- crates/federate/src/worker.rs | 1 + 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/crates/api_common/src/send_activity.rs b/crates/api_common/src/send_activity.rs index 6d9c722a1..ceaed4826 100644 --- a/crates/api_common/src/send_activity.rs +++ b/crates/api_common/src/send_activity.rs @@ -98,9 +98,9 @@ impl ActivityChannel { Ok(()) } - pub async fn close(outgoing_activities_task: JoinHandle>) -> LemmyResult<()> { + pub async fn close(outgoing_activities_task: JoinHandle<()>) -> LemmyResult<()> { ACTIVITY_CHANNEL.keepalive_sender.lock().await.take(); - outgoing_activities_task.await??; + outgoing_activities_task.await?; Ok(()) } } diff --git a/crates/apub/src/activities/mod.rs b/crates/apub/src/activities/mod.rs index ee3eb16ff..83d029d4e 100644 --- a/crates/apub/src/activities/mod.rs +++ b/crates/apub/src/activities/mod.rs @@ -225,11 +225,12 @@ where Ok(()) } -pub async fn handle_outgoing_activities(context: Data) -> LemmyResult<()> { +pub async fn handle_outgoing_activities(context: Data) { while let Some(data) = ActivityChannel::retrieve_activity().await { - match_outgoing_activities(data, &context.reset_request_count()).await? + if let Err(e) = match_outgoing_activities(data, &context.reset_request_count()).await { + tracing::warn!("error while saving outgoing activity to db: {e}"); + } } - Ok(()) } pub async fn match_outgoing_activities( diff --git a/crates/federate/src/worker.rs b/crates/federate/src/worker.rs index a383d61b2..963814ad9 100644 --- a/crates/federate/src/worker.rs +++ b/crates/federate/src/worker.rs @@ -171,6 +171,7 @@ impl InstanceWorker { .await .context("failed reading activity from db")? else { + tracing::debug!("{}: {:?} does not exist", self.instance.domain, id); self.state.last_successful_id = Some(id); continue; };