summary refs log tree commit diff
path: root/synapse/storage
diff options
context:
space:
mode:
authorMark Haines <mark.haines@matrix.org>2014-08-31 16:08:20 +0100
committerMark Haines <mark.haines@matrix.org>2014-08-31 16:08:20 +0100
commit3eb45eba0e387dacb67158efe323f19731799c79 (patch)
tree79d942de91b8c9a940e787da9b4a329047139a80 /synapse/storage
parentAdd store for server certificates and keys (diff)
parentAdd config tree to synapse. Add support for reading config from a file (diff)
downloadsynapse-3eb45eba0e387dacb67158efe323f19731799c79.tar.xz
Merge branch 'develop' into server2server_tls
Diffstat (limited to 'synapse/storage')
-rw-r--r--synapse/storage/stream.py9
1 files changed, 6 insertions, 3 deletions
diff --git a/synapse/storage/stream.py b/synapse/storage/stream.py
index 4f42afc015..0b78222827 100644
--- a/synapse/storage/stream.py
+++ b/synapse/storage/stream.py
@@ -205,8 +205,11 @@ class StreamStore(SQLBaseStore):
                              with_feedback=False):
         # TODO (erikj): Handle compressed feedback
 
-        from_comp = '<' if direction =='b' else '>'
-        to_comp = '>' if direction =='b' else '<'
+        # Tokens really represent positions between elements, but we use
+        # the convention of pointing to the event before the gap. Hence
+        # we have a bit of asymmetry when it comes to equalities.
+        from_comp = '<=' if direction =='b' else '>'
+        to_comp = '>' if direction =='b' else '<='
         order = "DESC" if direction == 'b' else "ASC"
 
         args = [room_id]
@@ -294,7 +297,7 @@ class StreamStore(SQLBaseStore):
         logger.debug("get_room_events_max_id: %s", res)
 
         if not res or not res[0] or not res[0]["m"]:
-            return "s1"
+            return "s0"
 
         key = res[0]["m"]
         return "s%d" % (key,)