chore: Refactor existing references to transaction service
This commit is contained in:
parent
e986cd4536
commit
21a97cdd0b
4 changed files with 8 additions and 8 deletions
|
|
@ -51,7 +51,7 @@ pub(crate) async fn send_message_event_route(
|
|||
// Check if this is a new transaction id
|
||||
if let Ok(response) = services
|
||||
.transaction_ids
|
||||
.existing_txnid(sender_user, sender_device, &body.txn_id)
|
||||
.get_client_txn(sender_user, sender_device, &body.txn_id)
|
||||
.await
|
||||
{
|
||||
// The client might have sent a txnid of the /sendToDevice endpoint
|
||||
|
|
@ -92,7 +92,7 @@ pub(crate) async fn send_message_event_route(
|
|||
)
|
||||
.await?;
|
||||
|
||||
services.transaction_ids.add_txnid(
|
||||
services.transaction_ids.add_client_txnid(
|
||||
sender_user,
|
||||
sender_device,
|
||||
&body.txn_id,
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ pub(crate) async fn send_event_to_device_route(
|
|||
// Check if this is a new transaction id
|
||||
if services
|
||||
.transaction_ids
|
||||
.existing_txnid(sender_user, sender_device, &body.txn_id)
|
||||
.get_client_txn(sender_user, sender_device, &body.txn_id)
|
||||
.await
|
||||
.is_ok()
|
||||
{
|
||||
|
|
@ -105,7 +105,7 @@ pub(crate) async fn send_event_to_device_route(
|
|||
// Save transaction id with empty data
|
||||
services
|
||||
.transaction_ids
|
||||
.add_txnid(sender_user, sender_device, &body.txn_id, &[]);
|
||||
.add_client_txnid(sender_user, sender_device, &body.txn_id, &[]);
|
||||
|
||||
Ok(send_event_to_device::v3::Response {})
|
||||
}
|
||||
|
|
|
|||
|
|
@ -479,7 +479,7 @@ async fn handle_edu_direct_to_device(
|
|||
// Check if this is a new transaction id
|
||||
if services
|
||||
.transaction_ids
|
||||
.existing_txnid(sender, None, message_id)
|
||||
.get_client_txn(sender, None, message_id)
|
||||
.await
|
||||
.is_ok()
|
||||
{
|
||||
|
|
@ -499,7 +499,7 @@ async fn handle_edu_direct_to_device(
|
|||
// Save transaction id with empty data
|
||||
services
|
||||
.transaction_ids
|
||||
.add_txnid(sender, None, message_id, &[]);
|
||||
.add_client_txnid(sender, None, message_id, &[]);
|
||||
}
|
||||
|
||||
async fn handle_edu_direct_to_device_user<Event: Send + Sync>(
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@ impl crate::Service for Service {
|
|||
}
|
||||
|
||||
impl Service {
|
||||
pub fn add_txnid(
|
||||
pub fn add_client_txnid(
|
||||
&self,
|
||||
user_id: &UserId,
|
||||
device_id: Option<&DeviceId>,
|
||||
|
|
@ -54,7 +54,7 @@ impl Service {
|
|||
self.db.userdevicetxnid_response.insert(&key, data);
|
||||
}
|
||||
|
||||
pub async fn existing_txnid(
|
||||
pub async fn get_client_txn(
|
||||
&self,
|
||||
user_id: &UserId,
|
||||
device_id: Option<&DeviceId>,
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue