update world gen queue comments

This commit is contained in:
James Seibel
2023-03-16 07:26:08 -05:00
parent 0ddd68b6e6
commit d7338a7bb7
2 changed files with 7 additions and 3 deletions
@@ -136,7 +136,7 @@ public class BatchGenerator implements IDhApiWorldGenerator
@Override
public boolean isBusy()
{
return this.generationGroup.getEventCount() > Math.max(Config.Client.Advanced.Threading.numberOfWorldGenerationThreads.get().intValue(), 1) * 40; // TODO the multiplier here should change dynamically based on how fast the generator is vs the queuing thread, this is too high and may cause issues when moving, but keeps the generator threads fed
return this.generationGroup.getEventCount() > Math.max(Config.Client.Advanced.Threading.numberOfWorldGenerationThreads.get().intValue(), 1) * 40; // TODO the multiplier here should change dynamically based on how fast the generator is vs the queuing thread, if this is too high it may cause issues when moving, but if it is too low the generator threads won't have enough tasks to work on
}
@@ -45,11 +45,15 @@ public class WorldGenerationQueue implements Closeable
/** If not null this generator is in the process of shutting down */
private volatile CompletableFuture<Void> generatorClosingFuture = null;
// TODO this logic isn't great and can cause a limit to how many thread could be used for world generation,
// however it won't cause duplicate request or concurrency issues, so it will be good enough for now
// TODO this logic isn't great and can cause a limit to how many threads could be used for world generation,
// however it won't cause duplicate requests or concurrency issues, so it will be good enough for now.
// A good long term fix may be to either:
// 1. allow the generator to deal with larger sections (let the generator threads split up larger tasks into smaller one
// 2. batch requests better. instead of sending 4 individual tasks of detail level N, send 1 task of detail level n+1
private final ExecutorService queueingThread = ThreadUtil.makeSingleThreadPool("World Gen Queue");
private boolean generationQueueStarted = false;
private DhBlockPos2D generationTargetPos = DhBlockPos2D.ZERO;
/** can be used for debugging how many tasks are currently in the queue */
private int numberOfTasksQueued = 0;
/**
* Settings this to true will cause the system to queue the first generation request it can find,