This is an automated email from the ASF dual-hosted git repository.
heneveld pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/brooklyn-server.git
The following commit(s) were added to refs/heads/master by this push:
new 92197fd0f7 accept a slight delay when replaying to allow previous
workflow to entirely finish
92197fd0f7 is described below
commit 92197fd0f71ee5a50c64db1698ed487902f90cb2
Author: Alex Heneveld <[email protected]>
AuthorDate: Fri Jun 2 12:26:47 2023 +0100
accept a slight delay when replaying to allow previous workflow to entirely
finish
---
.../apache/brooklyn/core/workflow/WorkflowExecutionContext.java | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git
a/core/src/main/java/org/apache/brooklyn/core/workflow/WorkflowExecutionContext.java
b/core/src/main/java/org/apache/brooklyn/core/workflow/WorkflowExecutionContext.java
index 19c28a6baa..14e69e0951 100644
---
a/core/src/main/java/org/apache/brooklyn/core/workflow/WorkflowExecutionContext.java
+++
b/core/src/main/java/org/apache/brooklyn/core/workflow/WorkflowExecutionContext.java
@@ -488,8 +488,13 @@ public class WorkflowExecutionContext {
// not sure we need this check
log.debug("Replaying containing workflow " +
WorkflowExecutionContext.this + " in task " + task + " which is an ancestor of
" + Tasks.current());
} else {
- log.warn("Unable to replay workflow " +
WorkflowExecutionContext.this + " from " + Tasks.current() + " because workflow
task " + task + " is ongoing (rethrowing)");
- throw new IllegalStateException("Cannot replay ongoing
workflow, given " + continuationInstructions);
+ log.warn("Unable to replay workflow " +
WorkflowExecutionContext.this + " from " + Tasks.current() + " because workflow
task " + task + " is ongoing; will delay up to 1s then retry");
+ // there can be a slight race between tasks ending and
the workflow reporting a failure and replaying;
+ // esp in tests, but also in real world, forgive such
a situation by delaying the replay for a short time
+ if (!task.blockUntilEnded(Duration.ONE_SECOND)) {
+ log.warn("Unable to replay workflow " +
WorkflowExecutionContext.this + " from " + Tasks.current() + " because workflow
task " + task + " is ongoing (waited 1s, still ongoing; so rethrowing)");
+ throw new IllegalStateException("Cannot replay
ongoing workflow, given " + continuationInstructions);
+ }
}
}
}