summary refs log tree commit diff
path: root/synapse/replication/slave/storage/receipts.py
diff options
context:
space:
mode:
authorErik Johnston <erik@matrix.org>2018-02-20 17:33:18 +0000
committerErik Johnston <erik@matrix.org>2018-02-20 17:43:57 +0000
commite316bbb4c07cad97c4cff5bc0c5b0dc2cd7bc519 (patch)
treea2d1b661e9aa15b9d8c07100bdcd77dc5fe7bd9c /synapse/replication/slave/storage/receipts.py
parentSplit ReceiptsStore (diff)
downloadsynapse-e316bbb4c07cad97c4cff5bc0c5b0dc2cd7bc519.tar.xz
Use abstract base class to access stream IDs
Diffstat (limited to 'synapse/replication/slave/storage/receipts.py')
-rw-r--r--synapse/replication/slave/storage/receipts.py9
1 files changed, 7 insertions, 2 deletions
diff --git a/synapse/replication/slave/storage/receipts.py b/synapse/replication/slave/storage/receipts.py
index 4e845ec041..a2eb4a02db 100644
--- a/synapse/replication/slave/storage/receipts.py
+++ b/synapse/replication/slave/storage/receipts.py
@@ -31,11 +31,16 @@ from synapse.storage.receipts import ReceiptsWorkerStore
 class SlavedReceiptsStore(ReceiptsWorkerStore, BaseSlavedStore):
 
     def __init__(self, db_conn, hs):
-        receipts_id_gen = SlavedIdTracker(
+        # We instansiate this first as the ReceiptsWorkerStore constructor
+        # needs to be able to call get_max_receipt_stream_id
+        self._receipts_id_gen = SlavedIdTracker(
             db_conn, "receipts_linearized", "stream_id"
         )
 
-        super(SlavedReceiptsStore, self).__init__(receipts_id_gen, db_conn, hs)
+        super(SlavedReceiptsStore, self).__init__(db_conn, hs)
+
+    def get_max_receipt_stream_id(self):
+        return self._receipts_id_gen.get_current_token()
 
     def stream_positions(self):
         result = super(SlavedReceiptsStore, self).stream_positions()