mirror of
https://git.anonymousland.org/anonymousland/synapse-product.git
synced 2025-06-24 20:30:26 -04:00
Require Collections as the parameters for simple_* methods. (#11580)
Instead of Iterable since the generators are not allowed due to the potential for their re-use.
This commit is contained in:
parent
323151b787
commit
f901f8b70e
3 changed files with 12 additions and 40 deletions
|
@ -22,7 +22,7 @@ from synapse.storage.database import DatabasePool, LoggingDatabaseConnection
|
|||
from synapse.storage.util.id_generators import StreamIdGenerator
|
||||
from synapse.types import JsonDict
|
||||
from synapse.util import json_encoder
|
||||
from synapse.util.caches.descriptors import cached, cachedList
|
||||
from synapse.util.caches.descriptors import cached
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from synapse.server import HomeServer
|
||||
|
@ -196,27 +196,6 @@ class PusherWorkerStore(SQLBaseStore):
|
|||
# This only exists for the cachedList decorator
|
||||
raise NotImplementedError()
|
||||
|
||||
@cachedList(
|
||||
cached_method_name="get_if_user_has_pusher",
|
||||
list_name="user_ids",
|
||||
num_args=1,
|
||||
)
|
||||
async def get_if_users_have_pushers(
|
||||
self, user_ids: Iterable[str]
|
||||
) -> Dict[str, bool]:
|
||||
rows = await self.db_pool.simple_select_many_batch(
|
||||
table="pushers",
|
||||
column="user_name",
|
||||
iterable=user_ids,
|
||||
retcols=["user_name"],
|
||||
desc="get_if_users_have_pushers",
|
||||
)
|
||||
|
||||
result = {user_id: False for user_id in user_ids}
|
||||
result.update({r["user_name"]: True for r in rows})
|
||||
|
||||
return result
|
||||
|
||||
async def update_pusher_last_stream_ordering(
|
||||
self, app_id, pushkey, user_id, last_stream_ordering
|
||||
) -> None:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue