fix: Don't panic if nobody's listening

This commit is contained in:
timedout
2026-02-23 17:22:37 +00:00
parent d4481b07ac
commit 8702f55cf5
2 changed files with 7 additions and 6 deletions
+3 -3
View File
@@ -214,9 +214,9 @@ fn fail_federation_txn(
services.transaction_ids.remove_federation_txn(txn_key);
// Send the error to any waiters
sender
.send(Some(Err(err)))
.expect("couldn't send error to channel");
if let Err(e) = sender.send(Some(Err(err))) {
debug_warn!("Failed to send transaction error to receivers: {e}");
}
}
/// Converts a TransactionError into an appropriate HTTP error response.
+4 -3
View File
@@ -11,6 +11,7 @@ use std::{
use async_trait::async_trait;
use conduwuit::{Error, Result, SyncRwLock, debug_warn, warn};
use database::{Handle, Map};
use futures::SinkExt;
use ruma::{
DeviceId, OwnedServerName, OwnedTransactionId, TransactionId, UserId,
api::{
@@ -239,9 +240,9 @@ impl Service {
}),
);
sender
.send(Some(Ok(response)))
.expect("couldn't send response to channel");
if let Err(e) = sender.send(Some(Ok(response))) {
debug_warn!("Failed to send transaction response to waiting receivers: {e}");
}
// explicitly close
drop(sender);