0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-09-30 04:38:52 +02:00

ircd:Ⓜ️:fetch: Add clear() to interface.

This commit is contained in:
Jason Volk 2019-07-22 14:20:21 -07:00
parent 53e7fe3fef
commit 4a37152c6d
3 changed files with 27 additions and 0 deletions

View file

@ -28,6 +28,7 @@ namespace ircd::m::fetch
bool cancel(request &);
bool start(const m::room::id &, const m::event::id &);
bool prefetch(const m::room::id &, const m::event::id &);
size_t clear();
// Composed operations
void auth_chain(const room &, const net::hostport &);

View file

@ -13388,6 +13388,18 @@ console_cmd__fetch(opt &out, const string_view &line)
return true;
}
bool
console_cmd__fetch__clear(opt &out, const string_view &line)
{
const size_t cleared
{
m::fetch::clear()
};
out << "Cleared " << cleared << std::endl;
return true;
}
//
// synchron
//

View file

@ -553,6 +553,20 @@ catch(const std::exception &e)
throw;
}
size_t
IRCD_MODULE_EXPORT
ircd::m::fetch::clear()
{
size_t ret{0};
for_each([&ret](auto &request)
{
ret += cancel(request);
return true;
});
return ret;
}
bool
IRCD_MODULE_EXPORT
ircd::m::fetch::prefetch(const m::room::id &room_id,