From c66ed11b4471320c0ee1c424ebe4097a701cca35 Mon Sep 17 00:00:00 2001 From: "Sofiane H. Djerbi" <46628754+kugge@users.noreply.github.com> Date: Mon, 24 Jul 2023 23:30:21 +0300 Subject: [PATCH] Use local pool --- patches/server/0043-Async-path-processing.patch | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/patches/server/0043-Async-path-processing.patch b/patches/server/0043-Async-path-processing.patch index fd46d5f..d87a045 100644 --- a/patches/server/0043-Async-path-processing.patch +++ b/patches/server/0043-Async-path-processing.patch @@ -318,7 +318,7 @@ index 0000000000000000000000000000000000000000..6b91852238f80d236fc44f766b115267 +} diff --git a/src/main/java/dev/kaiijumc/kaiiju/path/AsyncPathProcessor.java b/src/main/java/dev/kaiijumc/kaiiju/path/AsyncPathProcessor.java new file mode 100644 -index 0000000000000000000000000000000000000000..72890653f6d8d1ff03c32a92bb96c0665e7f94ec +index 0000000000000000000000000000000000000000..593a285a92431b7ebeaab0e965aa36bd3ef3d161 --- /dev/null +++ b/src/main/java/dev/kaiijumc/kaiiju/path/AsyncPathProcessor.java @@ -0,0 +1,44 @@ @@ -340,7 +340,6 @@ index 0000000000000000000000000000000000000000..72890653f6d8d1ff03c32a92bb96c066 + */ +public class AsyncPathProcessor { + -+ private static final Executor mainThreadExecutor = MinecraftServer.getServer(); + private static final Executor pathProcessingExecutor = Executors.newCachedThreadPool(new ThreadFactoryBuilder() + .setNameFormat("petal-path-processor-%d") + .setPriority(Thread.NORM_PRIORITY - 2) @@ -360,7 +359,8 @@ index 0000000000000000000000000000000000000000..72890653f6d8d1ff03c32a92bb96c066 + */ + public static void awaitProcessing(@Nullable Path path, Consumer<@Nullable Path> afterProcessing) { + if (path != null && !path.isProcessed() && path instanceof AsyncPath asyncPath) { -+ asyncPath.postProcessing(() -> mainThreadExecutor.execute(() -> afterProcessing.accept(path))); ++ // It should be mainThreadExecutor.execute() in here, but that's absent in Folia ++ asyncPath.postProcessing(() -> pathProcessingExecutor.execute(() -> afterProcessing.accept(path))); + } else { + afterProcessing.accept(path); + }