diff --git a/spider-flow-api/src/main/java/org/spiderflow/model/SpiderNode.java b/spider-flow-api/src/main/java/org/spiderflow/model/SpiderNode.java index ea1f9e0..3c02005 100644 --- a/spider-flow-api/src/main/java/org/spiderflow/model/SpiderNode.java +++ b/spider-flow-api/src/main/java/org/spiderflow/model/SpiderNode.java @@ -1,9 +1,6 @@ package org.spiderflow.model; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; +import java.util.*; import java.util.concurrent.atomic.AtomicInteger; import org.apache.commons.text.StringEscapeUtils; @@ -130,9 +127,12 @@ public class SpiderNode { } public boolean isDone(){ + return isDone(new HashSet<>()); + } + public boolean isDone(Set visited){ if(this.counter.get() == 0){ for (SpiderNode prevNode : prevNodes) { - if(!prevNode.isDone()){ + if(visited.add(nodeId)&&!prevNode.isDone(visited)){ return false; } }