mirror of
https://mau.dev/maunium/synapse.git
synced 2024-10-01 01:36:05 -04:00
Add a docstring to add_device_change_to_streams
and fix some nearby types (#11912)
This commit is contained in:
parent
0640f8ebaa
commit
3655585e85
1
changelog.d/11912.misc
Normal file
1
changelog.d/11912.misc
Normal file
@ -0,0 +1 @@
|
|||||||
|
Various refactors to the application service notifier code.
|
@ -1496,13 +1496,23 @@ class DeviceStore(DeviceWorkerStore, DeviceBackgroundUpdateStore):
|
|||||||
)
|
)
|
||||||
|
|
||||||
async def add_device_change_to_streams(
|
async def add_device_change_to_streams(
|
||||||
self, user_id: str, device_ids: Collection[str], hosts: List[str]
|
self, user_id: str, device_ids: Collection[str], hosts: Collection[str]
|
||||||
) -> int:
|
) -> Optional[int]:
|
||||||
"""Persist that a user's devices have been updated, and which hosts
|
"""Persist that a user's devices have been updated, and which hosts
|
||||||
(if any) should be poked.
|
(if any) should be poked.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
user_id: The ID of the user whose device changed.
|
||||||
|
device_ids: The IDs of any changed devices. If empty, this function will
|
||||||
|
return None.
|
||||||
|
hosts: The remote destinations that should be notified of the change.
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
The maximum stream ID of device list updates that were added to the database, or
|
||||||
|
None if no updates were added.
|
||||||
"""
|
"""
|
||||||
if not device_ids:
|
if not device_ids:
|
||||||
return
|
return None
|
||||||
|
|
||||||
async with self._device_list_id_gen.get_next_mult(
|
async with self._device_list_id_gen.get_next_mult(
|
||||||
len(device_ids)
|
len(device_ids)
|
||||||
@ -1573,11 +1583,11 @@ class DeviceStore(DeviceWorkerStore, DeviceBackgroundUpdateStore):
|
|||||||
self,
|
self,
|
||||||
txn: LoggingTransaction,
|
txn: LoggingTransaction,
|
||||||
user_id: str,
|
user_id: str,
|
||||||
device_ids: Collection[str],
|
device_ids: Iterable[str],
|
||||||
hosts: List[str],
|
hosts: Collection[str],
|
||||||
stream_ids: List[str],
|
stream_ids: List[str],
|
||||||
context: Dict[str, str],
|
context: Dict[str, str],
|
||||||
):
|
) -> None:
|
||||||
for host in hosts:
|
for host in hosts:
|
||||||
txn.call_after(
|
txn.call_after(
|
||||||
self._device_list_federation_stream_cache.entity_has_changed,
|
self._device_list_federation_stream_cache.entity_has_changed,
|
||||||
|
Loading…
Reference in New Issue
Block a user