Skip to content

Commit

Permalink
Copy RetryOptions on empty ContinueAsNewOptions
Browse files Browse the repository at this point in the history
  • Loading branch information
mfateev committed Jan 3, 2024
1 parent b539e51 commit 277fa61
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -1137,6 +1137,9 @@ public void continueAsNew(ContinueAsNewInput input) {
.determineUseCompatibleFlag(
replayContext.getTaskQueue().equals(options.getTaskQueue())));
}
} else if (replayContext.getRetryOptions() != null) {
// Have to copy retry options as server doesn't copy them.
attributes.setRetryPolicy(toRetryPolicy(replayContext.getRetryOptions()));
}

List<ContextPropagator> propagators =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,14 @@ public int execute(int count, String continueAsNewTaskQueue) {
Map<String, Object> memo = new HashMap<>();
memo.put("myKey", "MyValue");
RetryOptions retryOptions = null;
// don't specify retryOptions on the first continue-as-new to test that they are copied from
// don't specify ContinueAsNewOptions on the first continue-as-new to test that RetryOptions
// are copied from the previous run.
if (count == INITIAL_COUNT) {
TestContinueAsNew next = Workflow.newContinueAsNewStub(TestContinueAsNew.class);
next.execute(count - 1, continueAsNewTaskQueue);
throw new RuntimeException("unreachable");
}
// don't specify RetryOptions on the second continue-as-new to test that they are copied from
// the previous run.
if (count < INITIAL_COUNT - 1) {
retryOptions = RetryOptions.newBuilder().setMaximumAttempts(5).build();
Expand Down

0 comments on commit 277fa61

Please sign in to comment.