diff options
author | Patrick Cloke <clokep@users.noreply.github.com> | 2020-07-17 07:08:56 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-07-17 07:08:56 -0400 |
commit | 00e57b755c0122c93b694c9926dc2440ffc65104 (patch) | |
tree | c5b9f7489c7a16502b2c955841823999ed07fc6f /synapse/app/generic_worker.py | |
parent | Convert _base, profile, and _receipts handlers to async/await (#7860) (diff) | |
download | synapse-00e57b755c0122c93b694c9926dc2440ffc65104.tar.xz |
Convert synapse.app to async/await. (#7868)
Diffstat (limited to 'synapse/app/generic_worker.py')
-rw-r--r-- | synapse/app/generic_worker.py | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/synapse/app/generic_worker.py b/synapse/app/generic_worker.py index c0853eef22..c1b76d827b 100644 --- a/synapse/app/generic_worker.py +++ b/synapse/app/generic_worker.py @@ -21,7 +21,7 @@ from typing import Dict, Iterable, Optional, Set from typing_extensions import ContextManager -from twisted.internet import address, defer, reactor +from twisted.internet import address, reactor import synapse import synapse.events @@ -375,9 +375,8 @@ class GenericWorkerPresence(BasePresenceHandler): return _user_syncing() - @defer.inlineCallbacks - def notify_from_replication(self, states, stream_id): - parties = yield get_interested_parties(self.store, states) + async def notify_from_replication(self, states, stream_id): + parties = await get_interested_parties(self.store, states) room_ids_to_states, users_to_states = parties self.notifier.on_new_event( @@ -387,8 +386,7 @@ class GenericWorkerPresence(BasePresenceHandler): users=users_to_states.keys(), ) - @defer.inlineCallbacks - def process_replication_rows(self, token, rows): + async def process_replication_rows(self, token, rows): states = [ UserPresenceState( row.user_id, @@ -406,7 +404,7 @@ class GenericWorkerPresence(BasePresenceHandler): self.user_to_current_state[state.user_id] = state stream_id = token - yield self.notify_from_replication(states, stream_id) + await self.notify_from_replication(states, stream_id) def get_currently_syncing_users_for_replication(self) -> Iterable[str]: return [ |