summary refs log tree commit diff
path: root/synapse/storage
diff options
context:
space:
mode:
authorTulir Asokan <tulir@beeper.com>2021-09-22 10:31:05 -0400
committerGitHub <noreply@github.com>2021-09-22 15:31:05 +0100
commit03db6701d5379f4aa05037bd9ce23942c501874e (patch)
treec06ecf63f82ea8286e69a5c7f8315539b9b105d4 /synapse/storage
parentEnsure we mark sent knocks as outliers (#10873) (diff)
downloadsynapse-03db6701d5379f4aa05037bd9ce23942c501874e.tar.xz
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 <tulir@beeper.com>
Diffstat (limited to 'synapse/storage')
-rw-r--r--synapse/storage/databases/main/end_to_end_keys.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/synapse/storage/databases/main/end_to_end_keys.py b/synapse/storage/databases/main/end_to_end_keys.py
index 1f0a39eac4..a95ac34f09 100644
--- a/synapse/storage/databases/main/end_to_end_keys.py
+++ b/synapse/storage/databases/main/end_to_end_keys.py
@@ -824,6 +824,10 @@ class EndToEndKeyWorkerStore(EndToEndKeyBackgroundStore):
             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