Skip to content

Commit

Permalink
send queue: use the transaction id generated and saved in the db for …
Browse files Browse the repository at this point in the history
…network queries

Intense facepalm energy here.
  • Loading branch information
bnjbvr committed Jul 25, 2024
1 parent df04e3e commit 33b3bca
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
6 changes: 6 additions & 0 deletions crates/matrix-sdk-base/src/store/traits.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1288,6 +1288,12 @@ impl From<String> for ChildTransactionId {
}
}

impl Into<OwnedTransactionId> for ChildTransactionId {
fn into(self) -> OwnedTransactionId {
self.0
}
}

/// An event to be sent, depending on a [`QueuedEvent`] to be sent first.
///
/// Depending on whether the event has been sent or not, this will either update
Expand Down
10 changes: 8 additions & 2 deletions crates/matrix-sdk/src/send_queue.rs
Original file line number Diff line number Diff line change
Expand Up @@ -852,7 +852,11 @@ impl QueueStorage {
);

store
.save_send_queue_event(&self.room_id, TransactionId::new(), serializable)
.save_send_queue_event(
&self.room_id,
de.own_transaction_id.into(),
serializable,
)
.await
.map_err(RoomSendQueueStorageError::StorageError)?;
} else {
Expand Down Expand Up @@ -887,7 +891,9 @@ impl QueueStorage {
// Note: no reason is provided because we materialize the intent of "cancel
// sending the parent event".

if let Err(err) = room.redact(&event_id, None, None).await {
if let Err(err) =
room.redact(&event_id, None, Some(de.own_transaction_id.into())).await
{
warn!("error when sending a redact for {event_id}: {err}");
}
} else {
Expand Down

0 comments on commit 33b3bca

Please sign in to comment.