make activity channel infallible (#4295)

This commit is contained in:
phiresky 2023-12-18 19:17:10 +01:00 committed by GitHub
parent dcb89f52d6
commit 6790b54d4d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 7 additions and 5 deletions

View file

@ -98,9 +98,9 @@ impl ActivityChannel {
Ok(()) Ok(())
} }
pub async fn close(outgoing_activities_task: JoinHandle<LemmyResult<()>>) -> LemmyResult<()> { pub async fn close(outgoing_activities_task: JoinHandle<()>) -> LemmyResult<()> {
ACTIVITY_CHANNEL.keepalive_sender.lock().await.take(); ACTIVITY_CHANNEL.keepalive_sender.lock().await.take();
outgoing_activities_task.await??; outgoing_activities_task.await?;
Ok(()) Ok(())
} }
} }

View file

@ -225,11 +225,12 @@ where
Ok(()) Ok(())
} }
pub async fn handle_outgoing_activities(context: Data<LemmyContext>) -> LemmyResult<()> { pub async fn handle_outgoing_activities(context: Data<LemmyContext>) {
while let Some(data) = ActivityChannel::retrieve_activity().await { 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( pub async fn match_outgoing_activities(

View file

@ -171,6 +171,7 @@ impl InstanceWorker {
.await .await
.context("failed reading activity from db")? .context("failed reading activity from db")?
else { else {
tracing::debug!("{}: {:?} does not exist", self.instance.domain, id);
self.state.last_successful_id = Some(id); self.state.last_successful_id = Some(id);
continue; continue;
}; };