From b7261182e8e2b8e6ea4b451919e7292595983395 Mon Sep 17 00:00:00 2001 From: Cedric Beust Date: Mon, 18 Apr 2016 03:29:41 -0800 Subject: [PATCH] Fix error case. --- .../src/main/kotlin/com/beust/kobalt/internal/DynamicGraph.kt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/modules/kobalt-plugin-api/src/main/kotlin/com/beust/kobalt/internal/DynamicGraph.kt b/modules/kobalt-plugin-api/src/main/kotlin/com/beust/kobalt/internal/DynamicGraph.kt index 43aaaf63..b02b8b22 100644 --- a/modules/kobalt-plugin-api/src/main/kotlin/com/beust/kobalt/internal/DynamicGraph.kt +++ b/modules/kobalt-plugin-api/src/main/kotlin/com/beust/kobalt/internal/DynamicGraph.kt @@ -142,7 +142,7 @@ class DynamicGraphExecutor(val graph : DynamicGraph, val factory: IThreadW var gotError = false val nodesRun = hashSetOf() var newFreeNodes = HashSet(graph.freeNodes) - while (! gotError && running > 0 || newFreeNodes.size > 0) { + while (! gotError && (running > 0 || newFreeNodes.size > 0)) { nodesRun.addAll(newFreeNodes) val callables : List> = factory.createWorkers(newFreeNodes) callables.forEach { completion.submit(it) } @@ -160,6 +160,7 @@ class DynamicGraphExecutor(val graph : DynamicGraph, val factory: IThreadW newFreeNodes.addAll(graph.freeNodes.minus(nodesRun)) } else { log(2, "Task failed: $taskResult") + newFreeNodes.clear() gotError = true } } catch(ex: TimeoutException) {