mirror of
https://git.anonymousland.org/anonymousland/synapse-product.git
synced 2024-12-19 16:34:19 -05:00
Use another deferred list
This commit is contained in:
parent
b849a64f8d
commit
eceb554a2f
@ -380,15 +380,6 @@ class MessageHandler(BaseHandler):
|
|||||||
if limit is None:
|
if limit is None:
|
||||||
limit = 10
|
limit = 10
|
||||||
|
|
||||||
messages, token = yield self.store.get_recent_events_for_room(
|
|
||||||
room_id,
|
|
||||||
limit=limit,
|
|
||||||
end_token=now_token.room_key,
|
|
||||||
)
|
|
||||||
|
|
||||||
start_token = now_token.copy_and_replace("room_key", token[0])
|
|
||||||
end_token = now_token.copy_and_replace("room_key", token[1])
|
|
||||||
|
|
||||||
room_members = [
|
room_members = [
|
||||||
m for m in current_state.values()
|
m for m in current_state.values()
|
||||||
if m.type == EventTypes.Member
|
if m.type == EventTypes.Member
|
||||||
@ -396,6 +387,9 @@ class MessageHandler(BaseHandler):
|
|||||||
]
|
]
|
||||||
|
|
||||||
presence_handler = self.hs.get_handlers().presence_handler
|
presence_handler = self.hs.get_handlers().presence_handler
|
||||||
|
|
||||||
|
@defer.inlineCallbacks
|
||||||
|
def get_presence():
|
||||||
presence_defs = yield defer.DeferredList(
|
presence_defs = yield defer.DeferredList(
|
||||||
[
|
[
|
||||||
presence_handler.get_state(
|
presence_handler.get_state(
|
||||||
@ -409,7 +403,22 @@ class MessageHandler(BaseHandler):
|
|||||||
consumeErrors=True,
|
consumeErrors=True,
|
||||||
)
|
)
|
||||||
|
|
||||||
presence = [p for success, p in presence_defs if success]
|
defer.returnValue([p for success, p in presence_defs if success])
|
||||||
|
|
||||||
|
presence, (messages, token) = yield defer.gatherResults(
|
||||||
|
[
|
||||||
|
get_presence(),
|
||||||
|
self.store.get_recent_events_for_room(
|
||||||
|
room_id,
|
||||||
|
limit=limit,
|
||||||
|
end_token=now_token.room_key,
|
||||||
|
)
|
||||||
|
],
|
||||||
|
consumeErrors=True,
|
||||||
|
).addErrback(unwrapFirstError)
|
||||||
|
|
||||||
|
start_token = now_token.copy_and_replace("room_key", token[0])
|
||||||
|
end_token = now_token.copy_and_replace("room_key", token[1])
|
||||||
|
|
||||||
time_now = self.clock.time_msec()
|
time_now = self.clock.time_msec()
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user