Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

Send federation events concurrently #3078

Merged
merged 6 commits into from
Apr 10, 2018
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion synapse/federation/transaction_queue.py
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,10 @@ def handle_room_events(events):
events_by_room.setdefault(event.room_id, []).append(event)

yield logcontext.make_deferred_yieldable(defer.gatherResults(
[handle_room_events(evs) for evs in events_by_room.itervalues()],
[
logcontext.preserve_fn(handle_room_events)(evs)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

let's not preserve_fn for every event.. Either preserve_fn once, or use run_in_background (?)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So do logcontext.run_in_background(handle_room_events(evs))? Isn't that equivalent to preserve_fn?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

logcontext.run_in_background(handle_room_events, evs)

And yes it is, except that it doesn't create a new function object on each loop.

for evs in events_by_room.itervalues()
],
consumeErrors=True
))

Expand Down