Stub out ServerNoticesSender on the workers

... and have the sync endpoints call it directly rather than obsure indirection
via PresenceHandler
This commit is contained in:
Richard van der Hoff 2018-05-22 10:57:56 +01:00
parent d5dca9a04f
commit 8810685df9
6 changed files with 66 additions and 8 deletions

View file

@ -31,9 +31,6 @@ class ServerNoticesSender(object):
def on_user_syncing(self, user_id):
"""Called when the user performs a sync operation.
This is only called when /sync (or /events) is called on the synapse
master. In a deployment with synchrotrons, on_user_ip is called
Args:
user_id (str): mxid of user who synced
@ -45,7 +42,7 @@ class ServerNoticesSender(object):
)
def on_user_ip(self, user_id):
"""Called when a worker process saw a client request.
"""Called on the master when a worker process saw a client request.
Args:
user_id (str): mxid
@ -53,6 +50,9 @@ class ServerNoticesSender(object):
Returns:
Deferred
"""
# The synchrotrons use a stubbed version of ServerNoticesSender, so
# we check for notices to send to the user in on_user_ip as well as
# in on_user_syncing
return self._consent_server_notices.maybe_send_server_notice_to_user(
user_id,
)