VersionsStore - added try/catch for cleanup task
This commit is contained in:
parent
ccdcbc6350
commit
1d5c4ac7ab
@ -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);
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user