@@ -561,16 +561,15 @@ def set_shadow_banned_txn(txn: LoggingTransaction) -> None:
561561 updatevalues = {"shadow_banned" : shadow_banned },
562562 )
563563 # In order for this to apply immediately, clear the cache for this user.
564- tokens = self .db_pool .simple_select_onecol_txn (
564+ tokens = self .db_pool .simple_select_list_txn (
565565 txn ,
566566 table = "access_tokens" ,
567567 keyvalues = {"user_id" : user_id },
568- retcol = "token" ,
568+ retcols = ("token" ,),
569+ )
570+ self ._invalidate_cache_and_stream_bulk (
571+ txn , self .get_user_by_access_token , tokens
569572 )
570- for token in tokens :
571- self ._invalidate_cache_and_stream (
572- txn , self .get_user_by_access_token , (token ,)
573- )
574573 self ._invalidate_cache_and_stream (txn , self .get_user_by_id , (user_id ,))
575574
576575 await self .db_pool .runInteraction ("set_shadow_banned" , set_shadow_banned_txn )
@@ -2683,10 +2682,11 @@ def f(txn: LoggingTransaction) -> List[Tuple[str, int, Optional[str]]]:
26832682 )
26842683 tokens_and_devices = [(r [0 ], r [1 ], r [2 ]) for r in txn ]
26852684
2686- for token , _ , _ in tokens_and_devices :
2687- self ._invalidate_cache_and_stream (
2688- txn , self .get_user_by_access_token , (token ,)
2689- )
2685+ self ._invalidate_cache_and_stream_bulk (
2686+ txn ,
2687+ self .get_user_by_access_token ,
2688+ [(token ,) for token , _ , _ in tokens_and_devices ],
2689+ )
26902690
26912691 txn .execute ("DELETE FROM access_tokens WHERE %s" % where_clause , values )
26922692
0 commit comments