mirror of
https://github.com/PaperMC/Paper.git
synced 2024-11-24 19:46:21 +01:00
Do not immediately re-queue repeating tasks, or they may simply keep repeating on this tick, until the 35ms time limit runs out.
This commit is contained in:
parent
958acee5af
commit
4a932c11de
@ -49,6 +49,7 @@ public class CraftScheduler implements BukkitScheduler, Runnable {
|
||||
long firstTick = -1;
|
||||
long currentTick = -1;
|
||||
CraftTask first = null;
|
||||
TreeMap<CraftTask, Boolean> nextQueue = new TreeMap<CraftTask, Boolean>();
|
||||
do {
|
||||
synchronized (schedulerQueue) {
|
||||
first = null;
|
||||
@ -64,7 +65,7 @@ public class CraftScheduler implements BukkitScheduler, Runnable {
|
||||
processTask(first);
|
||||
if (first.getPeriod() >= 0) {
|
||||
first.updateExecution();
|
||||
schedulerQueue.put(first, first.isSync());
|
||||
nextQueue.put(first, first.isSync());
|
||||
}
|
||||
} else {
|
||||
stop = true;
|
||||
@ -78,6 +79,10 @@ public class CraftScheduler implements BukkitScheduler, Runnable {
|
||||
}
|
||||
} while (!stop);
|
||||
|
||||
synchronized (schedulerQueue) {
|
||||
schedulerQueue.putAll(nextQueue);
|
||||
}
|
||||
|
||||
long sleepTime = 0;
|
||||
if (first == null) {
|
||||
sleepTime = 60000L;
|
||||
|
Loading…
Reference in New Issue
Block a user