From 1731af3f29d21fc9ff69166c79391573c7a9a60e Mon Sep 17 00:00:00 2001 From: Mark Haines Date: Tue, 18 Nov 2014 16:44:52 +0000 Subject: [PATCH] SYN-104: When going backwards the end token should be before the last event --- synapse/storage/stream.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/synapse/storage/stream.py b/synapse/storage/stream.py index 475e7f20a..a95402467 100644 --- a/synapse/storage/stream.py +++ b/synapse/storage/stream.py @@ -253,6 +253,9 @@ class StreamStore(SQLBaseStore): if rows: topo = rows[-1]["topological_ordering"] toke = rows[-1]["stream_ordering"] + if direction == 'b': + topo -= 1 + toke -= 1 next_token = "t%s-%s" % (topo, toke) else: # TODO (erikj): We should work out what to do here instead.