Skip to content
This repository was archived by the owner on Apr 26, 2024. It is now read-only.

Commit 03db670

Browse files
authored
Fix invalidating OTK count cache after claim (#10875)
The invalidation was missing in `_claim_e2e_one_time_key_returning`, which is used on SQLite 3.24+ and Postgres. This could break e2ee if nothing else happened to invalidate the caches before the keys ran out. Signed-off-by: Tulir Asokan <[email protected]>
1 parent 8f2a527 commit 03db670

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

changelog.d/10875.bugfix

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Fix invalidating one-time key count cache after claiming keys. Contributed by Tulir at Beeper.

synapse/storage/databases/main/end_to_end_keys.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -824,6 +824,10 @@ def _claim_e2e_one_time_key_returning(
824824
if otk_row is None:
825825
return None
826826

827+
self._invalidate_cache_and_stream(
828+
txn, self.count_e2e_one_time_keys, (user_id, device_id)
829+
)
830+
827831
key_id, key_json = otk_row
828832
return f"{algorithm}:{key_id}", key_json
829833

0 commit comments

Comments
 (0)