diff options
author | Kegan Dougal <kegan@matrix.org> | 2015-01-12 17:38:30 +0000 |
---|---|---|
committer | Kegan Dougal <kegan@matrix.org> | 2015-01-12 17:38:40 +0000 |
commit | c43d8981191ea993d78dea8be93fe513ad107c3e (patch) | |
tree | aa213d0a134c7660715215fbf7cf01a3e7c50e82 /synapse | |
parent | Add copyrighter script for sql (diff) | |
download | synapse-c43d8981191ea993d78dea8be93fe513ad107c3e.tar.xz |
SYN-178: Fix off by one.
Diffstat (limited to 'synapse')
-rw-r--r-- | synapse/storage/stream.py | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/synapse/storage/stream.py b/synapse/storage/stream.py index bedc3c6c52..744c821dfe 100644 --- a/synapse/storage/stream.py +++ b/synapse/storage/stream.py @@ -284,8 +284,12 @@ class StreamStore(SQLBaseStore): rows.reverse() # As we selected with reverse ordering if rows: - topo = rows[0]["topological_ordering"] - toke = rows[0]["stream_ordering"] + # XXX: Always subtract 1 since the start token always goes + # backwards (parity with paginate_room_events). It isn't + # obvious that this is correct; we should clarify the algorithm + # used here. + topo = rows[0]["topological_ordering"] - 1 + toke = rows[0]["stream_ordering"] - 1 start_token = "t%s-%s" % (topo, toke) token = (start_token, end_token) |