diff --git a/solanaceae/zox/ngc_hs.cpp b/solanaceae/zox/ngc_hs.cpp index 2ab324e..d92a454 100644 --- a/solanaceae/zox/ngc_hs.cpp +++ b/solanaceae/zox/ngc_hs.cpp @@ -257,17 +257,25 @@ bool ZoxNGCHistorySync::onEvent(const Events::ZoxNGC_ngch_request& e) { const int64_t sync_delta_offset_ms = int64_t(e.sync_delta) * 1000 * 60; const uint64_t ts_start = Message::getTimeMS() - sync_delta_offset_ms; - auto view = reg.view(); - view.use(); - view.each([&](const Message3 e, const auto&, const auto& c_t, const auto& ts, const auto&, const auto&) { + auto view = reg.view(); + for (auto it = view.rbegin(), it_end = view.rend(); it != it_end; it++) { + const Message3 e = *it; + + if (!reg.all_of(e)) { + continue; // manual view filter + } + + const auto& c_t = reg.get(e); + const auto& ts = view.get(e); + // private if (!_cr.all_of(c_t.c)) { - return; + continue; } if (ts.ts < ts_start) { //std::cout << "---- " << ts.ts << " < " << ts_start << " -> too old\n"; - return; + continue; } if (reg.all_of(e)) { @@ -284,14 +292,14 @@ bool ZoxNGCHistorySync::onEvent(const Events::ZoxNGC_ngch_request& e) { ) { // self not found // TODO: config for self only - return; + continue; } } std::cout << "---- " << ts.ts << " >= " << ts_start << " -> selected\n"; msg_send_queue.push(e); - }); + } std::cout << "ZOX ngch_request selected " << msg_send_queue.size() << " messages\n";