This commit is contained in:
RePixelatedMC
2024-01-10 18:47:14 +01:00
parent f0f9261ed3
commit ffa0b984a0
@@ -421,22 +421,27 @@ public class Mantle {
} }
ioTrim.set(true); ioTrim.set(true);
//unloadLock.lock(); unloadLock.lock();
try { try {
Iris.debug("Trimming Tectonic Plates older than " + Form.duration(adjustedIdleDuration.get(), 0)); Iris.debug("Trimming Tectonic Plates older than " + Form.duration(adjustedIdleDuration.get(), 0));
if (lastUse != null) { if (lastUse != null) {
for (Long i : new ArrayList<>(lastUse.keySet())) { if (!lastUse.isEmpty()) {
double finalAdjustedIdleDuration = adjustedIdleDuration.get(); for (Long i : new ArrayList<>(lastUse.keySet())) {
hyperLock.withLong(i, () -> { double finalAdjustedIdleDuration = adjustedIdleDuration.get();
Long lastUseTime = lastUse.get(i); hyperLock.withLong(i, () -> {
if (lastUseTime != null && M.ms() - lastUseTime >= finalAdjustedIdleDuration) { Long lastUseTime = lastUse.get(i);
toUnload.add(i); if (lastUseTime != null && M.ms() - lastUseTime >= finalAdjustedIdleDuration) {
Iris.debug("Tectonic Region added to unload"); toUnload.add(i);
} Iris.debug("Tectonic Region added to unload");
}); Iris.panic();
}
});
}
} }
} }
} catch (Throwable e) {
Iris.reportError(e);
} finally { } finally {
ioTrim.set(false); ioTrim.set(false);
unloadLock.unlock(); unloadLock.unlock();