From 25c43b6aa24ffbd1b11f42a08f10479f4cdd6174 Mon Sep 17 00:00:00 2001 From: Jason Volk Date: Tue, 1 May 2018 14:51:13 -0700 Subject: [PATCH] modules/console: Add host prefetch by room to cache warm for testing etc. --- modules/console.cc | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/modules/console.cc b/modules/console.cc index 79d6294d5..58ba56656 100644 --- a/modules/console.cc +++ b/modules/console.cc @@ -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 //