mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-25 02:17:35 +01:00
Remove runner leak on async tasks. Fixes BUKKIT-3288
In some situations, an async task could be cancelled with no tasks pending. This means the finally {} block from run() never gets executed properly on the last async task to have run, as it expected to be executed again. This fix takes the only spot that the task period is set to cancelled and will check to see if the task should be purged from the runners list.
This commit is contained in:
parent
717fbbeffa
commit
ed6aab8200
@ -100,6 +100,9 @@ class CraftAsyncTask extends CraftTask {
|
||||
synchronized (workers) {
|
||||
// Synchronizing here prevents race condition for a completing task
|
||||
setPeriod(-2l);
|
||||
if (workers.isEmpty()) {
|
||||
runners.remove(getTaskId());
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user