Skip to content

Commit 3ac9595

Browse files
Pass retry policy when completing with continue as new (#995)
Co-authored-by: Bowei Xu <[email protected]>
1 parent 294cc54 commit 3ac9595

File tree

3 files changed

+11
-0
lines changed

3 files changed

+11
-0
lines changed

internal/internal_task_handlers.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -629,6 +629,7 @@ func (wth *workflowTaskHandlerImpl) createWorkflowContext(task *s.PollForDecisio
629629
ParentWorkflowExecution: parentWorkflowExecution,
630630
Memo: attributes.Memo,
631631
SearchAttributes: attributes.SearchAttributes,
632+
RetryPolicy: attributes.RetryPolicy,
632633
}
633634

634635
wfStartTime := time.Unix(0, h.Events[0].GetTimestamp())
@@ -1497,6 +1498,7 @@ func (wth *workflowTaskHandlerImpl) completeWorkflow(
14971498
Header: contErr.params.header,
14981499
Memo: workflowContext.workflowInfo.Memo,
14991500
SearchAttributes: workflowContext.workflowInfo.SearchAttributes,
1501+
RetryPolicy: workflowContext.workflowInfo.RetryPolicy,
15001502
}
15011503
} else if workflowContext.err != nil {
15021504
// Workflow failures

internal/internal_task_handlers_test.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -858,6 +858,12 @@ func (t *TaskHandlersTestSuite) TestGetWorkflowInfo() {
858858
workflowType := "GetWorkflowInfoWorkflow"
859859
lastCompletionResult, err := getDefaultDataConverter().ToData("lastCompletionData")
860860
t.NoError(err)
861+
retryPolicy := &s.RetryPolicy{
862+
InitialIntervalInSeconds: common.Int32Ptr(1),
863+
BackoffCoefficient: common.Float64Ptr(1.0),
864+
MaximumIntervalInSeconds: common.Int32Ptr(1),
865+
MaximumAttempts: common.Int32Ptr(3),
866+
}
861867
startedEventAttributes := &s.WorkflowExecutionStartedEventAttributes{
862868
Input: lastCompletionResult,
863869
TaskList: &s.TaskList{Name: &taskList},
@@ -869,6 +875,7 @@ func (t *TaskHandlersTestSuite) TestGetWorkflowInfo() {
869875
ExecutionStartToCloseTimeoutSeconds: &executionTimeout,
870876
TaskStartToCloseTimeoutSeconds: &taskTimeout,
871877
LastCompletionResult: lastCompletionResult,
878+
RetryPolicy: retryPolicy,
872879
}
873880
testEvents := []*s.HistoryEvent{
874881
createTestEventWorkflowExecutionStarted(1, startedEventAttributes),
@@ -904,6 +911,7 @@ func (t *TaskHandlersTestSuite) TestGetWorkflowInfo() {
904911
t.EqualValues(taskTimeout, result.TaskStartToCloseTimeoutSeconds)
905912
t.EqualValues(workflowType, result.WorkflowType.Name)
906913
t.EqualValues(testDomain, result.Domain)
914+
t.EqualValues(retryPolicy, result.RetryPolicy)
907915
}
908916

909917
func (t *TaskHandlersTestSuite) TestConsistentQuery_InvalidQueryTask() {

internal/workflow.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -741,6 +741,7 @@ type WorkflowInfo struct {
741741
Memo *s.Memo // Value can be decoded using data converter (DefaultDataConverter, or custom one if set).
742742
SearchAttributes *s.SearchAttributes // Value can be decoded using DefaultDataConverter.
743743
BinaryChecksum *string
744+
RetryPolicy *s.RetryPolicy
744745
}
745746

746747
func (wInfo *WorkflowInfo) GetBinaryChecksum() string {

0 commit comments

Comments
 (0)