Server: fix autosync OOM

This commit is contained in:
2025-03-23 16:04:19 +01:00
parent 9108b27dd3
commit 527395447c
2 changed files with 19 additions and 21 deletions

View File

@@ -46,30 +46,28 @@ public class AutosyncProcessor {
}
executorService.submit(() -> {
Log.info("Adding all to autosync");
ArrayList<JObjectKey> objs = new ArrayList<>();
txm.run(() -> {
Log.info("Adding all to autosync");
ArrayList<JObjectKey> objs = new ArrayList<>();
txm.run(() -> {
try (var it = curTx.getIterator(IteratorStart.GE, JObjectKey.first())) {
while (it.hasNext()) {
var key = it.peekNextKey();
objs.add(key);
// TODO: Nested transactions
it.skip();
}
try (var it = curTx.getIterator(IteratorStart.GE, JObjectKey.first())) {
while (it.hasNext()) {
var key = it.peekNextKey();
objs.add(key);
// TODO: Nested transactions
it.skip();
}
});
for (var obj : objs) {
txm.run(() -> {
var gotObj = curTx.get(JData.class, obj).orElse(null);
if (!(gotObj instanceof RemoteObjectMeta meta))
return;
if (!meta.hasLocalData())
add(meta.key());
});
}
});
for (var obj : objs) {
txm.run(() -> {
var gotObj = curTx.get(JData.class, obj).orElse(null);
if (!(gotObj instanceof RemoteObjectMeta meta))
return;
if (!meta.hasLocalData())
add(meta.key());
});
}
Log.info("Adding all to autosync: finished");
});
}

View File

@@ -129,7 +129,7 @@ public class SyncHandler {
if (proc != null) {
proc.prepareForInitialSync(peer, obj);
}
Log.tracev("Adding to initial sync for peer {0}: {1}", peer, obj);
Log.infov("Adding to initial sync for peer {0}: {1}", peer, obj);
invalidationQueueService.pushInvalidationToOne(peer, obj);
});
}