This repository has been archived by the owner on Apr 26, 2024. It is now read-only.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Experimental Federation Speedup #9702
Experimental Federation Speedup #9702
Changes from 12 commits
588631f
5ea99b1
79a5fd9
a30d979
027a574
daa9712
831ceda
2506f63
73e2c78
44fcea4
30e3338
fbfcadb
fc7e650
16c39da
621d637
632be5c
43f9e28
dc6730a
ad796a3
e7e6c67
9165cb5
bbf52d5
7a33b4c
a89cd8e
4551879
95ceb32
5703cd0
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
small warning: if we change this
[]
comprehension into a generator (()
), python will start throwing errors about async iterators, because to work with an async iterator/generator in a sub-comprehension, you have to prefix everyfor
withasync for
.I had split it before i realised it didn't solve the problem, and then i set this small generator to
[]
, which fixed it, but kept the split.This'll be a small memory tradeoff for readability, as this'd create a list of
len(events)
, but then the surrounding generator will filter out allNone
values, which will have itself take up no space until it is consumed by the dict comprehensionso this is a
len(events)
list ofOptional[Tuple[Eventbase, Collection[str]]
, then comprehended down intoDict[EventBase, Collection[str]]
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
distribution happens after database access, because then a database-access-crash-loop will cause no events to be spammed to other servers, but a crash loop will also cause federation to stall, which is much more noticeable in the logs (as only the errors will be visible)
also, i think it's "safer" to not have a race condition where
destination_room
values are set after pdus are actually distributedanywho, if either of these functions throw, it wont reach
update_federation_out_pos
, and it'll loop around withfinally:
and the next poke from a database sequence