mirror of
https://github.com/matrix-construct/construct
synced 2024-11-16 15:00:51 +01:00
modules/console: Add host prefetch by room to cache warm for testing etc.
This commit is contained in:
parent
f40831c8e6
commit
25c43b6aa2
1 changed files with 36 additions and 0 deletions
|
@ -1758,6 +1758,42 @@ console_cmd__net__host__cache__SRV(opt &out, const string_view &line)
|
|||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
console_cmd__net__host__prefetch(opt &out, const string_view &line)
|
||||
{
|
||||
const params param{line, " ",
|
||||
{
|
||||
"room_id",
|
||||
}};
|
||||
|
||||
const auto &room_id
|
||||
{
|
||||
m::room_id(param.at(0))
|
||||
};
|
||||
|
||||
const m::room room
|
||||
{
|
||||
room_id
|
||||
};
|
||||
|
||||
const m::room::origins origins
|
||||
{
|
||||
room
|
||||
};
|
||||
|
||||
size_t count{0};
|
||||
origins.for_each([&count](const string_view &origin)
|
||||
{
|
||||
net::dns(origin, net::dns::prefetch_ipport);
|
||||
++count;
|
||||
});
|
||||
|
||||
out << "Prefetch resolving " << count << " origins."
|
||||
<< std::endl;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
//
|
||||
// client
|
||||
//
|
||||
|
|
Loading…
Reference in a new issue