0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-12-27 07:54:05 +01:00

modules/console: Sort any vector of results for eval.

This commit is contained in:
Jason Volk 2018-05-07 16:52:00 -07:00
parent b3a063bdac
commit c1b98f43b3

View file

@ -4219,10 +4219,18 @@ console_cmd__fed__state(opt &out, const string_view &line)
vmopts
};
std::vector<m::event> events;
events.reserve(size(pdus) + size(auth_chain));
for(const json::object &event : auth_chain)
eval(event);
events.emplace_back(event);
for(const json::object &event : pdus)
events.emplace_back(event);
std::sort(begin(events), end(events));
events.erase(std::unique(begin(events), end(events)), end(events));
for(const auto &event : events)
eval(event);
return true;
@ -4366,7 +4374,14 @@ console_cmd__fed__backfill(opt &out, const string_view &line)
vmopts
};
std::vector<m::event> events;
events.reserve(lex_cast<size_t>(count));
for(const json::object &event : pdus)
events.emplace_back(event);
std::sort(begin(events), end(events));
events.erase(std::unique(begin(events), end(events)), end(events));
for(const auto &event : events)
eval(event);
return true;