mirror of
https://mau.dev/maunium/synapse.git
synced 2024-08-29 13:42:33 +00:00
Merge branch 'hotfixes-v0.1.0' of github.com:matrix-org/synapse
This commit is contained in:
commit
d5c94c922f
@ -106,7 +106,9 @@ class Notifier(object):
|
|||||||
|
|
||||||
# TODO (erikj): Can we make this more efficient by hitting the
|
# TODO (erikj): Can we make this more efficient by hitting the
|
||||||
# db once?
|
# db once?
|
||||||
for listener in listeners:
|
|
||||||
|
@defer.inlineCallbacks
|
||||||
|
def notify(listener):
|
||||||
events, end_token = yield source.get_new_events_for_user(
|
events, end_token = yield source.get_new_events_for_user(
|
||||||
listener.user,
|
listener.user,
|
||||||
listener.from_token,
|
listener.from_token,
|
||||||
@ -118,6 +120,13 @@ class Notifier(object):
|
|||||||
self, events, listener.from_token, end_token
|
self, events, listener.from_token, end_token
|
||||||
)
|
)
|
||||||
|
|
||||||
|
def eb(failure):
|
||||||
|
logger.exception("Failed to notify listener", failure)
|
||||||
|
|
||||||
|
yield defer.DeferredList(
|
||||||
|
[notify(l).addErrback(eb) for l in listeners]
|
||||||
|
)
|
||||||
|
|
||||||
@defer.inlineCallbacks
|
@defer.inlineCallbacks
|
||||||
@log_function
|
@log_function
|
||||||
def on_new_user_event(self, users=[], rooms=[]):
|
def on_new_user_event(self, users=[], rooms=[]):
|
||||||
@ -136,7 +145,8 @@ class Notifier(object):
|
|||||||
for room in rooms:
|
for room in rooms:
|
||||||
listeners |= self.rooms_to_listeners.get(room, set()).copy()
|
listeners |= self.rooms_to_listeners.get(room, set()).copy()
|
||||||
|
|
||||||
for listener in listeners:
|
@defer.inlineCallbacks
|
||||||
|
def notify(listener):
|
||||||
events, end_token = yield source.get_new_events_for_user(
|
events, end_token = yield source.get_new_events_for_user(
|
||||||
listener.user,
|
listener.user,
|
||||||
listener.from_token,
|
listener.from_token,
|
||||||
@ -148,6 +158,13 @@ class Notifier(object):
|
|||||||
self, events, listener.from_token, end_token
|
self, events, listener.from_token, end_token
|
||||||
)
|
)
|
||||||
|
|
||||||
|
def eb(failure):
|
||||||
|
logger.exception("Failed to notify listener", failure)
|
||||||
|
|
||||||
|
yield defer.DeferredList(
|
||||||
|
[notify(l).addErrback(eb) for l in listeners]
|
||||||
|
)
|
||||||
|
|
||||||
def get_events_for(self, user, rooms, pagination_config, timeout):
|
def get_events_for(self, user, rooms, pagination_config, timeout):
|
||||||
""" For the given user and rooms, return any new events for them. If
|
""" For the given user and rooms, return any new events for them. If
|
||||||
there are no new events wait for up to `timeout` milliseconds for any
|
there are no new events wait for up to `timeout` milliseconds for any
|
||||||
|
Loading…
Reference in New Issue
Block a user