VersionsStore - added try/catch for cleanup task

This commit is contained in:
Volodymyr Babak 2025-06-03 15:48:26 +03:00
parent ccdcbc6350
commit 1d5c4ac7ab

View File

@ -54,12 +54,16 @@ public class VersionsStore {
private void startCleanupTask() {
cleaner.scheduleAtFixedRate(() -> {
try {
long now = System.currentTimeMillis();
for (Map.Entry<EdqsObjectKey, TimedValue> entry : versions.entrySet()) {
if (now - entry.getValue().lastUpdated > expirationMillis) {
versions.remove(entry.getKey(), entry.getValue());
}
}
} catch (Exception e) {
log.error("Cleanup task failed", e);
}
}, expirationMillis, expirationMillis, TimeUnit.MILLISECONDS);
}