From c1b98f43b380c79e0f150c94b4f9df0a8f0d7427 Mon Sep 17 00:00:00 2001 From: Jason Volk Date: Mon, 7 May 2018 16:52:00 -0700 Subject: [PATCH] modules/console: Sort any vector of results for eval. --- modules/console.cc | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/modules/console.cc b/modules/console.cc index 5b50652fc..2a1fb0939 100644 --- a/modules/console.cc +++ b/modules/console.cc @@ -4219,10 +4219,18 @@ console_cmd__fed__state(opt &out, const string_view &line) vmopts }; + std::vector 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 events; + events.reserve(lex_cast(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;