Browse Source

fix: no notification counts for fast /syncs

transactions
Timo Kösters 1 month ago
parent
commit
8bcfff2766
Signed by: timo <timo@koesters.xyz> GPG Key ID: 24DA7517711A2BA4
1 changed files with 6 additions and 4 deletions
  1. +6
    -4
      src/database/rooms.rs

+ 6
- 4
src/database/rooms.rs View File

@@ -447,6 +447,11 @@ impl Rooms {
// This is also the next_batch/since value
let index = globals.next_count()?;

// Mark as read first so the sending client doesn't get a notification even if appending
// fails
self.edus
.private_read_set(&pdu.room_id, &pdu.sender, index, &globals)?;

let mut pdu_id = pdu.room_id.as_bytes().to_vec();
pdu_id.push(0xff);
pdu_id.extend_from_slice(&index.to_be_bytes());
@@ -503,9 +508,6 @@ impl Rooms {
_ => {}
}

self.edus
.private_read_set(&pdu.room_id, &pdu.sender, index, &globals)?;

Ok(pdu_id)
}

@@ -520,7 +522,7 @@ impl Rooms {
// Store state for event. The state does not include the event itself.
// Instead it's the state before the pdu, so the room's old state.
self.pduid_statehash
.insert(dbg!(new_pdu_id), &old_state_hash)?;
.insert(new_pdu_id, &old_state_hash)?;
if new_pdu.state_key.is_none() {
return Ok(old_state_hash);
}


Loading…
Cancel
Save