0
0
Fork 1
mirror of https://mau.dev/maunium/synapse.git synced 2024-12-14 07:43:48 +01:00

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>
This commit is contained in:
Tulir Asokan 2021-09-22 10:31:05 -04:00 committed by GitHub
parent 8f2a52766b
commit 03db6701d5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 0 deletions

1
changelog.d/10875.bugfix Normal file
View file

@ -0,0 +1 @@
Fix invalidating one-time key count cache after claiming keys. Contributed by Tulir at Beeper.

View file

@ -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