mirror of
https://github.com/usatiuk/dhfs.git
synced 2025-10-29 04:57:48 +01:00
Server: fix autosync OOM
This commit is contained in:
@@ -46,30 +46,28 @@ public class AutosyncProcessor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
executorService.submit(() -> {
|
executorService.submit(() -> {
|
||||||
|
Log.info("Adding all to autosync");
|
||||||
|
ArrayList<JObjectKey> objs = new ArrayList<>();
|
||||||
txm.run(() -> {
|
txm.run(() -> {
|
||||||
Log.info("Adding all to autosync");
|
try (var it = curTx.getIterator(IteratorStart.GE, JObjectKey.first())) {
|
||||||
ArrayList<JObjectKey> objs = new ArrayList<>();
|
while (it.hasNext()) {
|
||||||
txm.run(() -> {
|
var key = it.peekNextKey();
|
||||||
try (var it = curTx.getIterator(IteratorStart.GE, JObjectKey.first())) {
|
objs.add(key);
|
||||||
while (it.hasNext()) {
|
// TODO: Nested transactions
|
||||||
var key = it.peekNextKey();
|
it.skip();
|
||||||
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");
|
Log.info("Adding all to autosync: finished");
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -129,7 +129,7 @@ public class SyncHandler {
|
|||||||
if (proc != null) {
|
if (proc != null) {
|
||||||
proc.prepareForInitialSync(peer, obj);
|
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);
|
invalidationQueueService.pushInvalidationToOne(peer, obj);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user