Fetch server keys concurrently

This speeds up handling of /_matrix/federation/v1/send/:transaction_id
when more than one event contains unknown keys.

In particular, when receiving multiple PDUs with dead servers in their
auth chain, timeouts of each server accumulate and can make handling of
incoming requests take several minutes, to the point the client closes
the connection (eg. matrix.org has a 2 minute timeout), causing new
events to be dropped eventually.
This commit is contained in:
Val Lorentz 2023-11-24 20:05:42 +00:00 committed by strawberry
parent 87d1040386
commit d092820699
6 changed files with 156 additions and 53 deletions

View file

@ -220,7 +220,7 @@ where
let keys_result = services()
.rooms
.event_handler
.fetch_signing_keys(&x_matrix.origin, vec![x_matrix.key.to_owned()])
.fetch_signing_keys_for_server(&x_matrix.origin, vec![x_matrix.key.to_owned()])
.await;
let keys = match keys_result {