Convert synapse.app to async/await. (#7868)

This commit is contained in:
Patrick Cloke 2020-07-17 07:08:56 -04:00 committed by GitHub
parent 6fca1b3506
commit 00e57b755c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 37 additions and 41 deletions

View file

@ -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 [