diff options
author | Patrick Cloke <clokep@users.noreply.github.com> | 2022-09-22 08:47:49 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-09-22 12:47:49 +0000 |
commit | b7272b73aa38dcb19c9b075514f963390358113d (patch) | |
tree | ca88b0afe01a83585a6629ddf3ce34d6591d00f4 /synapse/storage/databases/main/stream.py | |
parent | Last batch of Pydantic for synapse/rest/client/account.py (#13832) (diff) | |
download | synapse-b7272b73aa38dcb19c9b075514f963390358113d.tar.xz |
Properly paginate forward in the /relations API. (#13840)
This fixes a bug where the `/relations` API with `dir=f` would skip the first item of each page (except the first page), causing incomplete data to be returned to the client.
Diffstat (limited to 'synapse/storage/databases/main/stream.py')
-rw-r--r-- | synapse/storage/databases/main/stream.py | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/synapse/storage/databases/main/stream.py b/synapse/storage/databases/main/stream.py index 3f9bfaeac5..530f04e149 100644 --- a/synapse/storage/databases/main/stream.py +++ b/synapse/storage/databases/main/stream.py @@ -1334,15 +1334,15 @@ class StreamWorkerStore(EventsWorkerStore, SQLBaseStore): if rows: topo = rows[-1].topological_ordering - toke = rows[-1].stream_ordering + token = rows[-1].stream_ordering if direction == "b": # Tokens are positions between events. # This token points *after* the last event in the chunk. # We need it to point to the event before it in the chunk # when we are going backwards so we subtract one from the # stream part. - toke -= 1 - next_token = RoomStreamToken(topo, toke) + token -= 1 + next_token = RoomStreamToken(topo, token) else: # TODO (erikj): We should work out what to do here instead. next_token = to_token if to_token else from_token |