From cc97c8d21ece1db030ba845fec91d6b2e4619275 Mon Sep 17 00:00:00 2001 From: Jesse Boyd Date: Sun, 24 Jun 2018 21:53:28 +1000 Subject: [PATCH] Tweak task scheduling for less tps impact --- core/src/main/java/com/boydti/fawe/util/SetQueue.java | 2 +- core/src/main/java/com/boydti/fawe/util/TaskManager.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/core/src/main/java/com/boydti/fawe/util/SetQueue.java b/core/src/main/java/com/boydti/fawe/util/SetQueue.java index 1bed49bd..ca0864e2 100644 --- a/core/src/main/java/com/boydti/fawe/util/SetQueue.java +++ b/core/src/main/java/com/boydti/fawe/util/SetQueue.java @@ -104,7 +104,7 @@ public class SetQueue { long currentAllocate = allocate - absDiff; if (!emptyTasks) { - long taskAllocate = empty ? currentAllocate : currentAllocate >> 1; + long taskAllocate = activeQueues.isEmpty() ? currentAllocate : 1 + (currentAllocate >> 1); long used = 0; boolean wait = false; do { diff --git a/core/src/main/java/com/boydti/fawe/util/TaskManager.java b/core/src/main/java/com/boydti/fawe/util/TaskManager.java index 683a2c49..2663924e 100644 --- a/core/src/main/java/com/boydti/fawe/util/TaskManager.java +++ b/core/src/main/java/com/boydti/fawe/util/TaskManager.java @@ -410,7 +410,7 @@ public abstract class TaskManager { } } }; - TaskManager.IMP.task(run); + SetQueue.IMP.addTask(run); try { synchronized (function) { while (running.get()) {