diff options
author | Mark Haines <mark.haines@matrix.org> | 2016-05-13 15:46:41 +0100 |
---|---|---|
committer | Mark Haines <mark.haines@matrix.org> | 2016-05-13 15:46:41 +0100 |
commit | b7381d5338e37b8c4c374f5458e578e05eb762d0 (patch) | |
tree | 6e1ab8695c67cc807d19ec5c3a867aa9e542620c /synapse/storage/receipts.py | |
parent | Merge pull request #741 from negzi/create_user_with_expiry (diff) | |
download | synapse-b7381d5338e37b8c4c374f5458e578e05eb762d0.tar.xz |
Allow receipts for events we haven't seen in the db
Diffstat (limited to '')
-rw-r--r-- | synapse/storage/receipts.py | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/synapse/storage/receipts.py b/synapse/storage/receipts.py index 94be820f86..fdcf28f3e1 100644 --- a/synapse/storage/receipts.py +++ b/synapse/storage/receipts.py @@ -249,9 +249,11 @@ class ReceiptsStore(SQLBaseStore): table="events", retcols=["topological_ordering", "stream_ordering"], keyvalues={"event_id": event_id}, + allow_none=True ) - topological_ordering = int(res["topological_ordering"]) - stream_ordering = int(res["stream_ordering"]) + + topological_ordering = int(res["topological_ordering"]) if res else None + stream_ordering = int(res["stream_ordering"]) if res else None # We don't want to clobber receipts for more recent events, so we # have to compare orderings of existing receipts @@ -264,7 +266,7 @@ class ReceiptsStore(SQLBaseStore): txn.execute(sql, (room_id, receipt_type, user_id)) results = txn.fetchall() - if results: + if results and topological_ordering: for to, so, _ in results: if int(to) > topological_ordering: return False @@ -294,7 +296,7 @@ class ReceiptsStore(SQLBaseStore): } ) - if receipt_type == "m.read": + if receipt_type == "m.read" and topological_ordering: self._remove_push_actions_before_txn( txn, room_id=room_id, |