Skip to content

Commit

Permalink
Make sure to process all chunks in PQE even if PARALLEL_THREADS = 1 (#…
Browse files Browse the repository at this point in the history
…2611)

make sure to process all chunks in PQE even if PARALLEL_THREADS = 1
  • Loading branch information
SirYwell committed Mar 15, 2024
1 parent 8363bad commit 10dc64e
Showing 1 changed file with 6 additions and 3 deletions.
Expand Up @@ -131,9 +131,12 @@ public <T extends Filter> T apply(Region region, T filter, boolean full) {

// Get a pool, to operate on the chunks in parallel
final int size = Math.min(chunks.size(), Settings.settings().QUEUE.PARALLEL_THREADS);
if (size <= 1 && chunksIter.hasNext()) {
BlockVector2 pos = chunksIter.next();
getExtent().apply(null, filter, region, pos.getX(), pos.getZ(), full);
if (size <= 1) {
// if PQE is ever used with PARALLEL_THREADS = 1, or only one chunk is edited, just run sequentially
while (chunksIter.hasNext()) {
BlockVector2 pos = chunksIter.next();
getExtent().apply(null, filter, region, pos.getX(), pos.getZ(), full);
}
} else {
final ForkJoinTask[] tasks = IntStream.range(0, size).mapToObj(i -> handler.submit(() -> {
try {
Expand Down

0 comments on commit 10dc64e

Please sign in to comment.