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

Process EDUs in parallel with PDUs. #6697

Merged
merged 5 commits into from
Jan 14, 2020

Conversation

erikjohnston
Copy link
Member

This means that things like to device messages don't get blocked behind processing PDUs, which can potentially take ages if e.g. the server has been down for a while and has a lot to catch up on.

We also process them in parallel like we do for PDUs.
This means that things like to device messages don't get blocked behind
processing PDUs, which can potentially take *ages*.
@erikjohnston erikjohnston force-pushed the erikj/edu_processing_parallel branch from 2eee0b3 to 1269e28 Compare January 13, 2020 12:33
@erikjohnston erikjohnston requested a review from a team January 13, 2020 12:50
@turt2live
Copy link
Member

Is this #5175 ?

@erikjohnston
Copy link
Member Author

Is this #5175 ?

This still blocks responding to the /send request until the EDUs are processed, its just that they happen at the same time as processing the PDUs now.

Copy link
Member

@anoadragon453 anoadragon453 left a comment

Choose a reason for hiding this comment

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

lgtm otherwise

run_in_background(self._handle_edus_in_txn, origin, transaction),
],
consumeErrors=True,
).addErrback(unwrapFirstError)
Copy link
Member

Choose a reason for hiding this comment

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

I'm not entirely sure how the error handling is working here. Will this raise an exception if one of the wrapped methods raise?

Copy link
Member Author

Choose a reason for hiding this comment

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

This is basically a copy from: https://github.com/matrix-org/synapse/blob/master/synapse/util/async_helpers.py#L167-L186

The way defer.gatherResults works is that:

  1. consumeErrors=True means that it won't report errors to the default "unhandled error" logging
  2. gatherResults will raise a FirstError that wrapse the actual exception. This is a bit annoying as we might be attempting to handle particular exceptions further up the stack, so we use unwrapFirstError which does what it says on the tin.

synapse/federation/federation_server.py Outdated Show resolved Hide resolved
synapse/federation/federation_server.py Outdated Show resolved Hide resolved
Co-Authored-By: Andrew Morgan <[email protected]>
@erikjohnston erikjohnston merged commit b5ce7f5 into develop Jan 14, 2020
@erikjohnston erikjohnston deleted the erikj/edu_processing_parallel branch February 5, 2020 17:35
babolivier pushed a commit that referenced this pull request Sep 1, 2021
* commit 'b5ce7f587':
  Process EDUs in parallel with PDUs. (#6697)
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants