diff --git a/src/main/java/com/ishland/flowsched/scheduler/StatusAdvancingScheduler.java b/src/main/java/com/ishland/flowsched/scheduler/StatusAdvancingScheduler.java index e7b5a8a..7c842a0 100644 --- a/src/main/java/com/ishland/flowsched/scheduler/StatusAdvancingScheduler.java +++ b/src/main/java/com/ishland/flowsched/scheduler/StatusAdvancingScheduler.java @@ -135,8 +135,8 @@ public boolean tick() { continue; } if (nextStatus == current) { - holder.cleanupDependencies(this); if (current.equals(getUnloadedStatus())) { + holder.cleanupDependencies(this); // System.out.println("Unloaded: " + key); this.onItemRemoval(holder); holder.release(); @@ -148,6 +148,7 @@ public boolean tick() { } continue; } + holder.submitOp(CompletableFuture.runAsync(() -> holder.cleanupDependencies(this), getBackgroundExecutor())); continue; // No need to update } if (current.ordinal() < nextStatus.ordinal()) {