improvement: only remove to-device events when sure the client received them
To make this work, I had to remove the recommended limit of 100 to-device events per /sync (https://matrix.org/docs/spec/client_server/latest#id72)
This commit is contained in:
parent
678f33acf9
commit
16576d19cd
2 changed files with 43 additions and 8 deletions
|
@ -2659,6 +2659,9 @@ pub fn sync_route(
|
|||
}
|
||||
}
|
||||
|
||||
// Remove all to-device events the device received *last time*
|
||||
db.users.remove_to_device_events(user_id, device_id, since)?;
|
||||
|
||||
Ok(sync_events::Response {
|
||||
next_batch,
|
||||
rooms: sync_events::Rooms {
|
||||
|
@ -2711,7 +2714,7 @@ pub fn sync_route(
|
|||
},
|
||||
device_one_time_keys_count: Default::default(), // TODO
|
||||
to_device: sync_events::ToDevice {
|
||||
events: db.users.take_to_device_events(user_id, device_id, 100)?,
|
||||
events: db.users.get_to_device_events(user_id, device_id)?,
|
||||
},
|
||||
}
|
||||
.into())
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue