Attempted fix for world timeout
This commit is contained in:
@@ -61,6 +61,10 @@ public class VoxyRenderSystem {
|
|||||||
public final ChunkBoundRenderer chunkBoundRenderer;
|
public final ChunkBoundRenderer chunkBoundRenderer;
|
||||||
|
|
||||||
public VoxyRenderSystem(WorldEngine world, ServiceThreadPool threadPool) {
|
public VoxyRenderSystem(WorldEngine world, ServiceThreadPool threadPool) {
|
||||||
|
//Keep the world loaded, NOTE: this is done FIRST, to keep and ensure that even if the rest of loading takes more
|
||||||
|
// than timeout, we keep the world acquired
|
||||||
|
world.acquireRef();
|
||||||
|
|
||||||
//Trigger the shared index buffer loading
|
//Trigger the shared index buffer loading
|
||||||
SharedIndexBuffer.INSTANCE.id();
|
SharedIndexBuffer.INSTANCE.id();
|
||||||
Capabilities.init();//Ensure clinit is called
|
Capabilities.init();//Ensure clinit is called
|
||||||
@@ -86,9 +90,6 @@ public class VoxyRenderSystem {
|
|||||||
this.renderDistanceTracker.setRenderDistance(VoxyConfig.CONFIG.sectionRenderDistance);
|
this.renderDistanceTracker.setRenderDistance(VoxyConfig.CONFIG.sectionRenderDistance);
|
||||||
|
|
||||||
this.chunkBoundRenderer = new ChunkBoundRenderer();
|
this.chunkBoundRenderer = new ChunkBoundRenderer();
|
||||||
|
|
||||||
//Keep the world loaded
|
|
||||||
this.worldIn.acquireRef();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setRenderDistance(int renderDistance) {
|
public void setRenderDistance(int renderDistance) {
|
||||||
|
|||||||
@@ -131,7 +131,7 @@ public abstract class VoxyInstance {
|
|||||||
if (this.activeWorlds.containsKey(identifier)) {
|
if (this.activeWorlds.containsKey(identifier)) {
|
||||||
throw new IllegalStateException("Existing world with identifier");
|
throw new IllegalStateException("Existing world with identifier");
|
||||||
}
|
}
|
||||||
Logger.info("Creating new world engine");
|
Logger.info("Creating new world engine: " + identifier.getLongHash());
|
||||||
var world = new WorldEngine(this.createStorage(identifier), this);
|
var world = new WorldEngine(this.createStorage(identifier), this);
|
||||||
world.setSaveCallback(this.savingService::enqueueSave);
|
world.setSaveCallback(this.savingService::enqueueSave);
|
||||||
this.activeWorlds.put(identifier, world);
|
this.activeWorlds.put(identifier, world);
|
||||||
@@ -158,6 +158,7 @@ public abstract class VoxyInstance {
|
|||||||
var world = this.activeWorlds.remove(id);
|
var world = this.activeWorlds.remove(id);
|
||||||
if (world == null) continue;//Race condition between unlock read and acquire write
|
if (world == null) continue;//Race condition between unlock read and acquire write
|
||||||
if (!world.isWorldIdle()) {this.activeWorlds.put(id, world); continue;}//No longer idle
|
if (!world.isWorldIdle()) {this.activeWorlds.put(id, world); continue;}//No longer idle
|
||||||
|
Logger.info("Shutting down idle world: " + id.getLongHash());
|
||||||
//If is here close and free the world
|
//If is here close and free the world
|
||||||
world.free();
|
world.free();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -101,4 +101,8 @@ public class WorldIdentifier {
|
|||||||
seed = (seed ^ seed >>> 27) * -7723592293110705685L;
|
seed = (seed ^ seed >>> 27) * -7723592293110705685L;
|
||||||
return seed ^ seed >>> 31;
|
return seed ^ seed >>> 31;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public long getLongHash() {
|
||||||
|
return this.hashCode;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user