Skip to content

Commit

Permalink
Fix invalidating OTK count cache after claim
Browse files Browse the repository at this point in the history
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 <tulir@beeper.com>
  • Loading branch information
tulir authored and bradtgmurray committed Sep 21, 2021
1 parent 9ecc172 commit 3e8105d
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions synapse/storage/databases/main/end_to_end_keys.py
Original file line number Diff line number Diff line change
Expand Up @@ -824,6 +824,10 @@ def _claim_e2e_one_time_key_returning(
if otk_row is None:
return None

self._invalidate_cache_and_stream(
txn, self.count_e2e_one_time_keys, (user_id, device_id)
)

key_id, key_json = otk_row
return f"{algorithm}:{key_id}", key_json

Expand Down

0 comments on commit 3e8105d

Please sign in to comment.