chore: Refactor transaction_ids -> transactions

This commit is contained in:
timedout
2026-02-23 17:44:35 +00:00
parent d311b87579
commit 558262dd1f
7 changed files with 15 additions and 16 deletions
+2 -2
View File
@@ -50,7 +50,7 @@ pub(crate) async fn send_message_event_route(
// Check if this is a new transaction id
if let Ok(response) = services
.transaction_ids
.transactions
.get_client_txn(sender_user, sender_device, &body.txn_id)
.await
{
@@ -92,7 +92,7 @@ pub(crate) async fn send_message_event_route(
)
.await?;
services.transaction_ids.add_client_txnid(
services.transactions.add_client_txnid(
sender_user,
sender_device,
&body.txn_id,
+2 -2
View File
@@ -26,7 +26,7 @@ pub(crate) async fn send_event_to_device_route(
// Check if this is a new transaction id
if services
.transaction_ids
.transactions
.get_client_txn(sender_user, sender_device, &body.txn_id)
.await
.is_ok()
@@ -104,7 +104,7 @@ pub(crate) async fn send_event_to_device_route(
// Save transaction id with empty data
services
.transaction_ids
.transactions
.add_client_txnid(sender_user, sender_device, &body.txn_id, &[]);
Ok(send_event_to_device::v3::Response {})
+6 -6
View File
@@ -43,7 +43,7 @@ use ruma::{
to_device::DeviceIdOrAllDevices,
uint,
};
use service::transaction_ids::{
use service::transactions::{
FederationTxnState, TransactionError, TxnKey, WrappedTransactionResponse,
};
use tokio::sync::watch::{Receiver, Sender};
@@ -84,7 +84,7 @@ pub(crate) async fn send_transaction_message_route(
// Atomically check cache, join active, or start new transaction
match services
.transaction_ids
.transactions
.get_or_start_federation_txn(txn_key.clone())?
{
| FederationTxnState::Cached(response) => {
@@ -195,7 +195,7 @@ async fn process_inbound_transaction(
};
services
.transaction_ids
.transactions
.finish_federation_txn(txn_key, sender, response);
}
@@ -211,7 +211,7 @@ fn fail_federation_txn(
debug!("Transaction failed: {err}");
// Remove from active state so the transaction can be retried
services.transaction_ids.remove_federation_txn(txn_key);
services.transactions.remove_federation_txn(txn_key);
// Send the error to any waiters
if let Err(e) = sender.send(Some(Err(err))) {
@@ -628,7 +628,7 @@ async fn handle_edu_direct_to_device(
// Check if this is a new transaction id
if services
.transaction_ids
.transactions
.get_client_txn(sender, None, message_id)
.await
.is_ok()
@@ -648,7 +648,7 @@ async fn handle_edu_direct_to_device(
// Save transaction id with empty data
services
.transaction_ids
.transactions
.add_client_txnid(sender, None, message_id, &[]);
}