0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-11-12 13:01:07 +01:00

ircd:Ⓜ️:feds: Add prelink loop before request loop w/ options toggle.

This commit is contained in:
Jason Volk 2020-10-16 00:38:32 -07:00
parent d04008a45f
commit a9a54f11de
2 changed files with 17 additions and 0 deletions

View file

@ -143,6 +143,11 @@ struct ircd::m::feds::opts
/// typical use case. /// typical use case.
bool exclude_myself {false}; bool exclude_myself {false};
/// Whether to iterate the query targets first to perform prelinks. This is
/// an asynchronous operation which may perform server name resolution and
/// link estab. The main request loop will then have fewer hazards.
bool prelink {true};
// Default construction is inline by member; this is defined to impose // Default construction is inline by member; this is defined to impose
// noexcept over `milliseconds timeout` which we guarantee won't throw. // noexcept over `milliseconds timeout` which we guarantee won't throw.
opts() noexcept {} opts() noexcept {}

View file

@ -441,6 +441,18 @@ ircd::m::feds::for_each_in_room(const opts &opts,
opts.room_id opts.room_id
}; };
// Prelink loop
if(opts.prelink)
origins.for_each([&opts]
(const string_view &origin)
{
if(opts.exclude_myself && my_host(origin))
return;
fed::prelink(origin);
});
// Request loop
origins.for_each([&opts, &ret, &closure, &create_closure] origins.for_each([&opts, &ret, &closure, &create_closure]
(const string_view &origin) (const string_view &origin)
{ {