mirror of
https://github.com/hoytech/strfry.git
synced 2025-06-17 00:38:50 +00:00
clean-up expiration logic a bit
This commit is contained in:
@ -85,7 +85,8 @@ void RelayServer::runCron() {
|
|||||||
auto expiration = lmdb::from_sv<uint64_t>(k);
|
auto expiration = lmdb::from_sv<uint64_t>(k);
|
||||||
auto levId = lmdb::from_sv<uint64_t>(v);
|
auto levId = lmdb::from_sv<uint64_t>(v);
|
||||||
|
|
||||||
if (levId == mostRecent) return true;
|
if (expiration > now) return false;
|
||||||
|
if (levId == mostRecent) return true; // don't delete because it could cause levId re-use
|
||||||
|
|
||||||
if (expiration == 1) { // Ephemeral event
|
if (expiration == 1) { // Ephemeral event
|
||||||
auto view = env.lookup_Event(txn, levId);
|
auto view = env.lookup_Event(txn, levId);
|
||||||
@ -96,12 +97,12 @@ void RelayServer::runCron() {
|
|||||||
numEphemeral++;
|
numEphemeral++;
|
||||||
expiredLevIds.emplace_back(levId);
|
expiredLevIds.emplace_back(levId);
|
||||||
}
|
}
|
||||||
} else if (expiration <= now) {
|
} else {
|
||||||
numExpired++;
|
numExpired++;
|
||||||
expiredLevIds.emplace_back(levId);
|
expiredLevIds.emplace_back(levId);
|
||||||
}
|
}
|
||||||
|
|
||||||
return expiration <= now;
|
return true;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user