|
|
@@ -561,16 +561,15 @@ class RegistrationWorkerStore(CacheInvalidationWorkerStore): |
|
|
|
updatevalues={"shadow_banned": shadow_banned}, |
|
|
|
) |
|
|
|
# In order for this to apply immediately, clear the cache for this user. |
|
|
|
tokens = self.db_pool.simple_select_onecol_txn( |
|
|
|
tokens = self.db_pool.simple_select_list_txn( |
|
|
|
txn, |
|
|
|
table="access_tokens", |
|
|
|
keyvalues={"user_id": user_id}, |
|
|
|
retcol="token", |
|
|
|
retcols=("token",), |
|
|
|
) |
|
|
|
self._invalidate_cache_and_stream_bulk( |
|
|
|
txn, self.get_user_by_access_token, tokens |
|
|
|
) |
|
|
|
for token in tokens: |
|
|
|
self._invalidate_cache_and_stream( |
|
|
|
txn, self.get_user_by_access_token, (token,) |
|
|
|
) |
|
|
|
self._invalidate_cache_and_stream(txn, self.get_user_by_id, (user_id,)) |
|
|
|
|
|
|
|
await self.db_pool.runInteraction("set_shadow_banned", set_shadow_banned_txn) |
|
|
@@ -2683,10 +2682,11 @@ class RegistrationStore(StatsStore, RegistrationBackgroundUpdateStore): |
|
|
|
) |
|
|
|
tokens_and_devices = [(r[0], r[1], r[2]) for r in txn] |
|
|
|
|
|
|
|
for token, _, _ in tokens_and_devices: |
|
|
|
self._invalidate_cache_and_stream( |
|
|
|
txn, self.get_user_by_access_token, (token,) |
|
|
|
) |
|
|
|
self._invalidate_cache_and_stream_bulk( |
|
|
|
txn, |
|
|
|
self.get_user_by_access_token, |
|
|
|
[(token,) for token, _, _ in tokens_and_devices], |
|
|
|
) |
|
|
|
|
|
|
|
txn.execute("DELETE FROM access_tokens WHERE %s" % where_clause, values) |
|
|
|
|
|
|
|