0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-11-04 21:08:57 +01:00

modules/console: Add event horizon flush cmd.

This commit is contained in:
Jason Volk 2019-05-17 02:20:39 -07:00
parent c119c84c2f
commit 18354901dc

View file

@ -6480,6 +6480,43 @@ console_cmd__event__horizon(opt &out, const string_view &line)
return true;
}
bool
console_cmd__event__horizon__flush(opt &out, const string_view &line)
{
size_t count(0);
const m::event::horizon horizon;
horizon.for_each([&out, &count]
(const auto &event_id, const auto &event_idx)
{
m::room::id::buf room_id_buf;
const string_view &room_id
{
m::get(std::nothrow, event_idx, "room_id", room_id_buf)
};
if(!room_id)
{
out << "- failed to find room_id for " << event_id
<< " from " << event_idx
<< std::endl;
return true;
}
m::fetch::start(room_id, event_id);
out << room_id << " : "
<< event_id
<< " via " << event_idx
<< std::endl;
++count;
return true;
});
out << "started " << count << std::endl;
return true;
}
bool
console_cmd__event__cached(opt &out, const string_view &line)
{