From 1b094576d75bb7a95203a7bc568fe08d22a3487d Mon Sep 17 00:00:00 2001 From: James Seibel Date: Sun, 24 Sep 2023 21:03:11 -0500 Subject: [PATCH] Fix sampling source pooling --- .../core/file/fullDatafile/FullDataFileHandler.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/core/src/main/java/com/seibel/distanthorizons/core/file/fullDatafile/FullDataFileHandler.java b/core/src/main/java/com/seibel/distanthorizons/core/file/fullDatafile/FullDataFileHandler.java index b3bef09eb..fd2236665 100644 --- a/core/src/main/java/com/seibel/distanthorizons/core/file/fullDatafile/FullDataFileHandler.java +++ b/core/src/main/java/com/seibel/distanthorizons/core/file/fullDatafile/FullDataFileHandler.java @@ -367,7 +367,7 @@ public class FullDataFileHandler implements IFullDataSourceProvider FullDataMetaFile existingFile = existingFiles.get(i); - CompletableFuture loadFileFuture = usePooledDataSources ? existingFile.getOrLoadCachedDataSourceAsync() : existingFile.getDataSourceWithoutCachingAsync(); + CompletableFuture loadFileFuture = usePooledDataSources ? existingFile.getDataSourceWithoutCachingAsync() : existingFile.getOrLoadCachedDataSourceAsync(); CompletableFuture sampleSourceFuture = loadFileFuture.whenComplete((existingFullDataSource, ex) -> { @@ -396,7 +396,7 @@ public class FullDataFileHandler implements IFullDataSourceProvider } // pooling temporary data sources massively reduces garbage collector overhead when just sampling (going from ~8 GB/sec to ~90 MB/sec) - if (!usePooledDataSources && !existingFile.cacheLoadingDataSource) + if (usePooledDataSources && !existingFile.cacheLoadingDataSource) { existingFile.clearCachedDataSource();