diff options
author | Richard van der Hoff <richard@matrix.org> | 2016-03-03 11:39:25 +0000 |
---|---|---|
committer | Richard van der Hoff <richard@matrix.org> | 2016-03-03 11:39:25 +0000 |
commit | 79f34bdbc2720a832cdab36ba58e83201e549c41 (patch) | |
tree | 2bdadb2bd2d2dac1a6722c4d33ca81febb7d7ece /synapse/storage/receipts.py | |
parent | Fix typo (diff) | |
parent | jenkins.sh: set -x (diff) | |
download | synapse-79f34bdbc2720a832cdab36ba58e83201e549c41.tar.xz |
Merge branch 'develop' into rav/SYN-642
Diffstat (limited to 'synapse/storage/receipts.py')
-rw-r--r-- | synapse/storage/receipts.py | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/synapse/storage/receipts.py b/synapse/storage/receipts.py index a7343c97f7..dbc074d6b5 100644 --- a/synapse/storage/receipts.py +++ b/synapse/storage/receipts.py @@ -330,7 +330,7 @@ class ReceiptsStore(SQLBaseStore): "insert_receipt_conv", graph_to_linear ) - stream_id_manager = yield self._receipts_id_gen.get_next(self) + stream_id_manager = self._receipts_id_gen.get_next() with stream_id_manager as stream_id: have_persisted = yield self.runInteraction( "insert_linearized_receipt", @@ -347,7 +347,7 @@ class ReceiptsStore(SQLBaseStore): room_id, receipt_type, user_id, event_ids, data ) - max_persisted_id = yield self._stream_id_gen.get_max_token() + max_persisted_id = self._stream_id_gen.get_max_token() defer.returnValue((stream_id, max_persisted_id)) @@ -390,3 +390,19 @@ class ReceiptsStore(SQLBaseStore): "data": json.dumps(data), } ) + + def get_all_updated_receipts(self, last_id, current_id, limit): + def get_all_updated_receipts_txn(txn): + sql = ( + "SELECT stream_id, room_id, receipt_type, user_id, event_id, data" + " FROM receipts_linearized" + " WHERE ? < stream_id AND stream_id <= ?" + " ORDER BY stream_id ASC" + " LIMIT ?" + ) + txn.execute(sql, (last_id, current_id, limit)) + + return txn.fetchall() + return self.runInteraction( + "get_all_updated_receipts", get_all_updated_receipts_txn + ) |