mirror of
https://github.com/matrix-construct/construct
synced 2024-11-17 15:30:52 +01:00
modules/console: Add event horizon flush cmd.
This commit is contained in:
parent
c119c84c2f
commit
18354901dc
1 changed files with 37 additions and 0 deletions
|
@ -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)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue