9
0
mirror of https://github.com/VolmitSoftware/Iris.git synced 2025-12-30 12:29:20 +00:00

fix lastUse

This commit is contained in:
CrazyDev22
2023-12-25 13:52:31 +01:00
parent e46b68e2f3
commit 729bcc7ba0

View File

@@ -22,7 +22,7 @@ import java.util.function.Supplier;
public class IrisEngineSVC implements IrisService {
private static final AtomicInteger tectonicLimit = new AtomicInteger(30);
private final ReentrantLock lastUseLock = new ReentrantLock();
private final KMap<Engine, Long> lastUse = new KMap<>();
private final KMap<World, Long> lastUse = new KMap<>();
private Looper cacheTicker;
private Looper trimTicker;
private Looper unloadTicker;
@@ -53,7 +53,7 @@ public class IrisEngineSVC implements IrisService {
long now = System.currentTimeMillis();
lastUseLock.lock();
try {
for (Engine key : new ArrayList<>(lastUse.keySet())) {
for (World key : new ArrayList<>(lastUse.keySet())) {
Long last = lastUse.get(key);
if (last == null)
continue;
@@ -128,7 +128,8 @@ public class IrisEngineSVC implements IrisService {
}
try {
for (int j = 0; j < worlds.size(); j++) {
PlatformChunkGenerator generator = IrisToolbelt.access(worlds.get(i.getAndIncrement()));
World world = worlds.get(i.getAndIncrement());
PlatformChunkGenerator generator = IrisToolbelt.access(world);
if (i.get() >= worlds.size()) {
i.set(0);
}
@@ -137,7 +138,7 @@ public class IrisEngineSVC implements IrisService {
Engine engine = generator.getEngine();
if (engine != null) {
lastUseLock.lock();
lastUse.put(engine, System.currentTimeMillis());
lastUse.put(world, System.currentTimeMillis());
lastUseLock.unlock();
return engine;
}