From 6ec6beedbdd290d094fd6e011e1d20429947121b Mon Sep 17 00:00:00 2001 From: Hugo Manrique Date: Fri, 13 Mar 2020 18:17:06 +0100 Subject: [PATCH 1/2] Remove tasks from lookup map upon completion --- .../com/velocitypowered/proxy/scheduler/VelocityScheduler.java | 1 + 1 file changed, 1 insertion(+) diff --git a/proxy/src/main/java/com/velocitypowered/proxy/scheduler/VelocityScheduler.java b/proxy/src/main/java/com/velocitypowered/proxy/scheduler/VelocityScheduler.java index 0bd4bcd3d..f0605f0b6 100644 --- a/proxy/src/main/java/com/velocitypowered/proxy/scheduler/VelocityScheduler.java +++ b/proxy/src/main/java/com/velocitypowered/proxy/scheduler/VelocityScheduler.java @@ -187,6 +187,7 @@ public class VelocityScheduler implements Scheduler { } catch (Exception e) { Log.logger.error("Exception in task {} by plugin {}", runnable, plugin, e); } finally { + onFinish(); currentTaskThread = null; } }); From d7224229473819617b555d22a8da1783ed335fe7 Mon Sep 17 00:00:00 2001 From: Hugo Manrique Date: Fri, 13 Mar 2020 18:52:15 +0100 Subject: [PATCH 2/2] Only finish non-repeating tasks --- .../velocitypowered/proxy/scheduler/VelocityScheduler.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/proxy/src/main/java/com/velocitypowered/proxy/scheduler/VelocityScheduler.java b/proxy/src/main/java/com/velocitypowered/proxy/scheduler/VelocityScheduler.java index f0605f0b6..1bec0d119 100644 --- a/proxy/src/main/java/com/velocitypowered/proxy/scheduler/VelocityScheduler.java +++ b/proxy/src/main/java/com/velocitypowered/proxy/scheduler/VelocityScheduler.java @@ -3,7 +3,6 @@ package com.velocitypowered.proxy.scheduler; import static com.google.common.base.Preconditions.checkArgument; import static com.google.common.base.Preconditions.checkNotNull; -import com.google.common.base.Preconditions; import com.google.common.collect.ImmutableList; import com.google.common.collect.Multimap; import com.google.common.collect.Multimaps; @@ -187,7 +186,9 @@ public class VelocityScheduler implements Scheduler { } catch (Exception e) { Log.logger.error("Exception in task {} by plugin {}", runnable, plugin, e); } finally { - onFinish(); + if (repeat == 0) { + onFinish(); + } currentTaskThread = null; } });