diff --git a/core/src/main/java/com/seibel/distanthorizons/core/file/fullDatafile/GeneratedFullDataSourceProvider.java b/core/src/main/java/com/seibel/distanthorizons/core/file/fullDatafile/GeneratedFullDataSourceProvider.java
index dc2abe9cf..da87e0128 100644
--- a/core/src/main/java/com/seibel/distanthorizons/core/file/fullDatafile/GeneratedFullDataSourceProvider.java
+++ b/core/src/main/java/com/seibel/distanthorizons/core/file/fullDatafile/GeneratedFullDataSourceProvider.java
@@ -47,7 +47,15 @@ public class GeneratedFullDataSourceProvider extends FullDataSourceProviderV2 im
{
private static final Logger LOGGER = DhLoggerBuilder.getLogger();
- public static final int MAX_WORLD_GEN_REQUESTS_PER_THREAD = 20;
+ /**
+ * Having this number too high causes the system to become overwhelmed by
+ * world gen requests and other jobs won't be done.
+ * IE: LODs won't update or render because world gen is hogging the CPU.
+ *
+ * TODO this should be dynamically allocated based on CPU load
+ * and abilities.
+ */
+ public static final int MAX_WORLD_GEN_REQUESTS_PER_THREAD = 2;
private final AtomicReference worldGenQueueRef = new AtomicReference<>(null);
@@ -172,6 +180,15 @@ public class GeneratedFullDataSourceProvider extends FullDataSourceProviderV2 im
}
+ ThreadPoolExecutor fileExecutor = ThreadPoolUtil.getFileHandlerExecutor();
+ if (fileExecutor == null || fileExecutor.getQueue().size() >= MAX_UPDATE_TASK_COUNT / 2)
+ {
+ // don't queue additional world gen requests if the file handler is overwhelmed,
+ // otherwise LODs may not load in properly
+ return false;
+ }
+
+
int maxQueueCount = MAX_WORLD_GEN_REQUESTS_PER_THREAD * Config.Client.Advanced.MultiThreading.numberOfWorldGenerationThreads.get();
if (this.delayedFullDataSourceSaveCache.getUnsavedCount() >= maxQueueCount)