Skip to content
Snippets Groups Projects
Unverified Commit 8bcfff27 authored by Timo Kösters's avatar Timo Kösters
Browse files

fix: no notification counts for fast /syncs

parent ea3aaa6b
No related branches found
No related tags found
No related merge requests found
...@@ -447,6 +447,11 @@ pub fn append_pdu( ...@@ -447,6 +447,11 @@ pub fn append_pdu(
// This is also the next_batch/since value // This is also the next_batch/since value
let index = globals.next_count()?; 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(); let mut pdu_id = pdu.room_id.as_bytes().to_vec();
pdu_id.push(0xff); pdu_id.push(0xff);
pdu_id.extend_from_slice(&index.to_be_bytes()); pdu_id.extend_from_slice(&index.to_be_bytes());
...@@ -503,9 +508,6 @@ pub fn append_pdu( ...@@ -503,9 +508,6 @@ pub fn append_pdu(
_ => {} _ => {}
} }
self.edus
.private_read_set(&pdu.room_id, &pdu.sender, index, &globals)?;
Ok(pdu_id) Ok(pdu_id)
} }
...@@ -520,7 +522,7 @@ pub fn append_to_state(&self, new_pdu_id: &[u8], new_pdu: &PduEvent) -> Result<S ...@@ -520,7 +522,7 @@ pub fn append_to_state(&self, new_pdu_id: &[u8], new_pdu: &PduEvent) -> Result<S
// Store state for event. The state does not include the event itself. // 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. // Instead it's the state before the pdu, so the room's old state.
self.pduid_statehash 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() { if new_pdu.state_key.is_none() {
return Ok(old_state_hash); return Ok(old_state_hash);
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment