Skip to content

Commit

Permalink
Pass retry policy when completing with continue as new (#995)
Browse files Browse the repository at this point in the history
Co-authored-by: Bowei Xu <[email protected]>
  • Loading branch information
vytautas-karpavicius and vancexu authored Jul 13, 2020
1 parent 294cc54 commit 3ac9595
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 0 deletions.
2 changes: 2 additions & 0 deletions internal/internal_task_handlers.go
Original file line number Diff line number Diff line change
Expand Up @@ -629,6 +629,7 @@ func (wth *workflowTaskHandlerImpl) createWorkflowContext(task *s.PollForDecisio
ParentWorkflowExecution: parentWorkflowExecution,
Memo: attributes.Memo,
SearchAttributes: attributes.SearchAttributes,
RetryPolicy: attributes.RetryPolicy,
}

wfStartTime := time.Unix(0, h.Events[0].GetTimestamp())
Expand Down Expand Up @@ -1497,6 +1498,7 @@ func (wth *workflowTaskHandlerImpl) completeWorkflow(
Header: contErr.params.header,
Memo: workflowContext.workflowInfo.Memo,
SearchAttributes: workflowContext.workflowInfo.SearchAttributes,
RetryPolicy: workflowContext.workflowInfo.RetryPolicy,
}
} else if workflowContext.err != nil {
// Workflow failures
Expand Down
8 changes: 8 additions & 0 deletions internal/internal_task_handlers_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -858,6 +858,12 @@ func (t *TaskHandlersTestSuite) TestGetWorkflowInfo() {
workflowType := "GetWorkflowInfoWorkflow"
lastCompletionResult, err := getDefaultDataConverter().ToData("lastCompletionData")
t.NoError(err)
retryPolicy := &s.RetryPolicy{
InitialIntervalInSeconds: common.Int32Ptr(1),
BackoffCoefficient: common.Float64Ptr(1.0),
MaximumIntervalInSeconds: common.Int32Ptr(1),
MaximumAttempts: common.Int32Ptr(3),
}
startedEventAttributes := &s.WorkflowExecutionStartedEventAttributes{
Input: lastCompletionResult,
TaskList: &s.TaskList{Name: &taskList},
Expand All @@ -869,6 +875,7 @@ func (t *TaskHandlersTestSuite) TestGetWorkflowInfo() {
ExecutionStartToCloseTimeoutSeconds: &executionTimeout,
TaskStartToCloseTimeoutSeconds: &taskTimeout,
LastCompletionResult: lastCompletionResult,
RetryPolicy: retryPolicy,
}
testEvents := []*s.HistoryEvent{
createTestEventWorkflowExecutionStarted(1, startedEventAttributes),
Expand Down Expand Up @@ -904,6 +911,7 @@ func (t *TaskHandlersTestSuite) TestGetWorkflowInfo() {
t.EqualValues(taskTimeout, result.TaskStartToCloseTimeoutSeconds)
t.EqualValues(workflowType, result.WorkflowType.Name)
t.EqualValues(testDomain, result.Domain)
t.EqualValues(retryPolicy, result.RetryPolicy)
}

func (t *TaskHandlersTestSuite) TestConsistentQuery_InvalidQueryTask() {
Expand Down
1 change: 1 addition & 0 deletions internal/workflow.go
Original file line number Diff line number Diff line change
Expand Up @@ -741,6 +741,7 @@ type WorkflowInfo struct {
Memo *s.Memo // Value can be decoded using data converter (DefaultDataConverter, or custom one if set).
SearchAttributes *s.SearchAttributes // Value can be decoded using DefaultDataConverter.
BinaryChecksum *string
RetryPolicy *s.RetryPolicy
}

func (wInfo *WorkflowInfo) GetBinaryChecksum() string {
Expand Down

0 comments on commit 3ac9595

Please sign in to comment.