Way to tired

This commit is contained in:
RePixelatedMC
2023-12-24 15:00:02 +01:00
parent 2193b02c0a
commit 0783620104
3 changed files with 8 additions and 4 deletions
@@ -102,7 +102,7 @@ public class IrisEngineSVC implements IrisService {
Engine engine = supplier.get(); Engine engine = supplier.get();
if (engine != null) { if (engine != null) {
long unloadStart = System.currentTimeMillis(); long unloadStart = System.currentTimeMillis();
int count = engine.getMantle().unloadTectonicPlate(); int count = engine.getMantle().unloadTectonicPlate(tectonicLimit.get());
if (count > 0) { if (count > 0) {
Iris.info(C.GOLD + "Unloaded " + C.YELLOW + count + " TectonicPlates in " + C.RED + Form.duration(System.currentTimeMillis() - unloadStart, 2)); Iris.info(C.GOLD + "Unloaded " + C.YELLOW + count + " TectonicPlates in " + C.RED + Form.duration(System.currentTimeMillis() - unloadStart, 2));
} }
@@ -178,8 +178,8 @@ public interface EngineMantle extends IObjectPlacer {
default void trim(int limit) { default void trim(int limit) {
getMantle().trim(TimeUnit.SECONDS.toMillis(IrisSettings.get().getPerformance().getMantleKeepAlive()), limit); getMantle().trim(TimeUnit.SECONDS.toMillis(IrisSettings.get().getPerformance().getMantleKeepAlive()), limit);
} }
default int unloadTectonicPlate(){ default int unloadTectonicPlate(int tectonicLimit){
return getMantle().unloadTectonicPlate(); return getMantle().unloadTectonicPlate(tectonicLimit);
} }
default MultiBurst burst() { default MultiBurst burst() {
@@ -445,7 +445,11 @@ public class Mantle {
} }
} }
public int unloadTectonicPlate() { public int unloadTectonicPlate(int tectonicLimit) {
// todo: make a advanced unloader
if (toUnload.size() > tectonicLimit){
dynamicThreads.set(2);
}
AtomicInteger i = new AtomicInteger(); AtomicInteger i = new AtomicInteger();
unloadLock.lock(); unloadLock.lock();
try { try {