ruma / homeserver

A Matrix homeserver written in Rust.
https://www.ruma.io/
1.08k stars 41 forks source link

Use the previous next_batch token when there are no new events #185

Closed mujx closed 7 years ago

mujx commented 7 years ago

Currently in order to compute the next_batch token for the /sync response we start from an initial value (zero), and compare it with the ordering of the new events to get the maximum value. If there are no new events to compare with the returned value is zero. This process is repeated for the room and the presence key.

To fix this we use the current since parameter (if present) as a starting point instead of zero.

Also the max_ordering variable in presence was renamed to presence_key to better reflect its usage since the timestamp is used as a next_batch identifier for presence and not the event ordering.