mirror of
https://github.com/hoytech/strfry.git
synced 2025-06-19 09:36:43 +00:00
sync optimisations, DBQuery no longer loads eventPayload
- It is now up to the caller to do so - QueryScheduler now can optionally not bother to ensure that the events are fresh
This commit is contained in:
@ -57,18 +57,24 @@ void cmd_sync(const std::vector<std::string> &subArgs) {
|
||||
auto txn = env.txn_ro();
|
||||
|
||||
uint64_t numEvents = 0;
|
||||
std::vector<uint64_t> levIds;
|
||||
|
||||
while (1) {
|
||||
bool complete = query.process(txn, [&](const auto &sub, uint64_t levId, std::string_view eventPayload){
|
||||
auto ev = lookupEventByLevId(txn, levId);
|
||||
ne.addItem(ev.flat_nested()->created_at(), sv(ev.flat_nested()->id()).substr(0, ne.idSize));
|
||||
|
||||
bool complete = query.process(txn, [&](const auto &sub, uint64_t levId){
|
||||
levIds.push_back(levId);
|
||||
numEvents++;
|
||||
});
|
||||
|
||||
if (complete) break;
|
||||
}
|
||||
|
||||
std::sort(levIds.begin(), levIds.end());
|
||||
|
||||
for (auto levId : levIds) {
|
||||
auto ev = lookupEventByLevId(txn, levId);
|
||||
ne.addItem(ev.flat_nested()->created_at(), sv(ev.flat_nested()->id()).substr(0, ne.idSize));
|
||||
}
|
||||
|
||||
LI << "Filter matches " << numEvents << " events";
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user