Skip to content

Commit 2507a45

Browse files
committed
send queue: add useful logs when aborting/editing a local echo
1 parent a7e4849 commit 2507a45

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

crates/matrix-sdk/src/send_queue.rs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -863,14 +863,21 @@ impl SendHandle {
863863
///
864864
/// Returns true if the sending could be aborted, false if not (i.e. the
865865
/// event had already been sent).
866+
#[instrument(skip(self), fields(room_id = %self.room.inner.room.room_id(), txn_id = %self.transaction_id))]
866867
pub async fn abort(self) -> Result<bool, RoomSendQueueStorageError> {
868+
trace!("received an abort request");
869+
867870
if self.room.inner.queue.cancel(&self.transaction_id).await? {
871+
trace!("successful abort");
872+
868873
// Propagate a cancelled update too.
869874
let _ = self.room.inner.updates.send(RoomSendQueueUpdate::CancelledLocalEvent {
870875
transaction_id: self.transaction_id.clone(),
871876
});
877+
872878
Ok(true)
873879
} else {
880+
debug!("event was being sent, can't abort");
874881
Ok(false)
875882
}
876883
}
@@ -879,21 +886,28 @@ impl SendHandle {
879886
///
880887
/// Returns true if the event to be sent was replaced, false if not (i.e.
881888
/// the event had already been sent).
889+
#[instrument(skip(self, new_content), fields(room_id = %self.room.inner.room.room_id(), txn_id = %self.transaction_id))]
882890
pub async fn edit_raw(
883891
&self,
884892
new_content: Raw<AnyMessageLikeEventContent>,
885893
event_type: String,
886894
) -> Result<bool, RoomSendQueueStorageError> {
895+
trace!("received an edit request");
896+
887897
let serializable = SerializableEventContent::from_raw(new_content, event_type);
888898

889899
if self.room.inner.queue.replace(&self.transaction_id, serializable.clone()).await? {
900+
trace!("successful edit");
901+
890902
// Propagate a replaced update too.
891903
let _ = self.room.inner.updates.send(RoomSendQueueUpdate::ReplacedLocalEvent {
892904
transaction_id: self.transaction_id.clone(),
893905
new_content: serializable,
894906
});
907+
895908
Ok(true)
896909
} else {
910+
debug!("event was being sent, can't edit");
897911
Ok(false)
898912
}
899913
}

0 commit comments

Comments
 (0)