summary refs log tree commit diff
path: root/synapse/storage/util
diff options
context:
space:
mode:
authorErik Johnston <erik@matrix.org>2015-07-16 18:18:36 +0100
committerErik Johnston <erik@matrix.org>2015-07-16 18:18:36 +0100
commitb6d4a4c6d883a4c3084938e11fc5bb654b5779e4 (patch)
treedbcdb1eb3459c5a53c7bdb8117d2aaee26332366 /synapse/storage/util
parentMerge pull request #203 from matrix-org/erikj/room_creation_presets (diff)
parentDocs (diff)
downloadsynapse-b6d4a4c6d883a4c3084938e11fc5bb654b5779e4.tar.xz
Merge pull request #199 from matrix-org/erikj/receipts
Implement read receipts.
Diffstat (limited to 'synapse/storage/util')
-rw-r--r--synapse/storage/util/id_generators.py7
1 files changed, 5 insertions, 2 deletions
diff --git a/synapse/storage/util/id_generators.py b/synapse/storage/util/id_generators.py
index 83eab63098..e956df62c7 100644
--- a/synapse/storage/util/id_generators.py
+++ b/synapse/storage/util/id_generators.py
@@ -72,7 +72,10 @@ class StreamIdGenerator(object):
         with stream_id_gen.get_next_txn(txn) as stream_id:
             # ... persist event ...
     """
-    def __init__(self):
+    def __init__(self, table, column):
+        self.table = table
+        self.column = column
+
         self._lock = threading.Lock()
 
         self._current_max = None
@@ -157,7 +160,7 @@ class StreamIdGenerator(object):
 
     def _get_or_compute_current_max(self, txn):
         with self._lock:
-            txn.execute("SELECT MAX(stream_ordering) FROM events")
+            txn.execute("SELECT MAX(%s) FROM %s" % (self.column, self.table))
             rows = txn.fetchall()
             val, = rows[0]