mirror of
https://git.anonymousland.org/anonymousland/synapse.git
synced 2025-06-20 19:54:07 -04:00
Fix typing for notifier (#8064)
This commit is contained in:
parent
6ba621d786
commit
9d1e4942ab
6 changed files with 38 additions and 16 deletions
|
@ -25,6 +25,7 @@ from typing import (
|
|||
Set,
|
||||
Tuple,
|
||||
TypeVar,
|
||||
Union,
|
||||
)
|
||||
|
||||
from prometheus_client import Counter
|
||||
|
@ -186,7 +187,7 @@ class Notifier(object):
|
|||
self.store = hs.get_datastore()
|
||||
self.pending_new_room_events = (
|
||||
[]
|
||||
) # type: List[Tuple[int, EventBase, Collection[str]]]
|
||||
) # type: List[Tuple[int, EventBase, Collection[Union[str, UserID]]]]
|
||||
|
||||
# Called when there are new things to stream over replication
|
||||
self.replication_callbacks = [] # type: List[Callable[[], None]]
|
||||
|
@ -246,7 +247,7 @@ class Notifier(object):
|
|||
event: EventBase,
|
||||
room_stream_id: int,
|
||||
max_room_stream_id: int,
|
||||
extra_users: Collection[str] = [],
|
||||
extra_users: Collection[Union[str, UserID]] = [],
|
||||
):
|
||||
""" Used by handlers to inform the notifier something has happened
|
||||
in the room, room event wise.
|
||||
|
@ -282,7 +283,10 @@ class Notifier(object):
|
|||
self._on_new_room_event(event, room_stream_id, extra_users)
|
||||
|
||||
def _on_new_room_event(
|
||||
self, event: EventBase, room_stream_id: int, extra_users: Collection[str] = []
|
||||
self,
|
||||
event: EventBase,
|
||||
room_stream_id: int,
|
||||
extra_users: Collection[Union[str, UserID]] = [],
|
||||
):
|
||||
"""Notify any user streams that are interested in this room event"""
|
||||
# poke any interested application service.
|
||||
|
@ -310,7 +314,7 @@ class Notifier(object):
|
|||
self,
|
||||
stream_key: str,
|
||||
new_token: int,
|
||||
users: Collection[str] = [],
|
||||
users: Collection[Union[str, UserID]] = [],
|
||||
rooms: Collection[str] = [],
|
||||
):
|
||||
""" Used to inform listeners that something has happened event wise.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue