Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Rename dt and di variables to workflowTask/wt #2999

Merged
merged 2 commits into from
Jun 15, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 8 additions & 9 deletions service/history/historyEngine.go
Original file line number Diff line number Diff line change
Expand Up @@ -1199,18 +1199,17 @@ func (e *historyEngineImpl) DescribeWorkflowExecution(
}
}

if workflowTask, ok := mutableState.GetPendingWorkflowTask(); ok {
pendingWorkflowTask := &workflowpb.PendingWorkflowTaskInfo{
if pendingWorkflowTask, ok := mutableState.GetPendingWorkflowTask(); ok {
result.PendingWorkflowTask = &workflowpb.PendingWorkflowTaskInfo{
State: enumspb.PENDING_WORKFLOW_TASK_STATE_SCHEDULED,
ScheduledTime: workflowTask.ScheduledTime,
OriginalScheduledTime: workflowTask.OriginalScheduledTime,
Attempt: workflowTask.Attempt,
ScheduledTime: pendingWorkflowTask.ScheduledTime,
OriginalScheduledTime: pendingWorkflowTask.OriginalScheduledTime,
Attempt: pendingWorkflowTask.Attempt,
}
if workflowTask.StartedEventID != common.EmptyEventID {
pendingWorkflowTask.State = enumspb.PENDING_WORKFLOW_TASK_STATE_STARTED
pendingWorkflowTask.StartedTime = workflowTask.StartedTime
if pendingWorkflowTask.StartedEventID != common.EmptyEventID {
result.PendingWorkflowTask.State = enumspb.PENDING_WORKFLOW_TASK_STATE_STARTED
result.PendingWorkflowTask.StartedTime = pendingWorkflowTask.StartedTime
}
result.PendingWorkflowTask = pendingWorkflowTask
}

return result, nil
Expand Down
38 changes: 19 additions & 19 deletions service/history/historyEngine2_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ func (s *engine2Suite) TestRecordWorkflowTaskStartedSuccessStickyEnabled() {
executionInfo.StickyTaskQueue = stickyTl

addWorkflowExecutionStartedEvent(msBuilder, we, "wType", tl, payloads.EncodeString("input"), 100*time.Second, 50*time.Second, 200*time.Second, identity)
di := addWorkflowTaskScheduledEvent(msBuilder)
wt := addWorkflowTaskScheduledEvent(msBuilder)

ms := workflow.TestCloneToProto(msBuilder)

Expand Down Expand Up @@ -238,12 +238,12 @@ func (s *engine2Suite) TestRecordWorkflowTaskStartedSuccessStickyEnabled() {
if executionInfo.LastWorkflowTaskStartedEventId != common.EmptyEventID {
expectedResponse.PreviousStartedEventId = executionInfo.LastWorkflowTaskStartedEventId
}
expectedResponse.ScheduledEventId = di.ScheduledEventID
expectedResponse.ScheduledTime = di.ScheduledTime
expectedResponse.StartedEventId = di.ScheduledEventID + 1
expectedResponse.ScheduledEventId = wt.ScheduledEventID
expectedResponse.ScheduledTime = wt.ScheduledTime
expectedResponse.StartedEventId = wt.ScheduledEventID + 1
expectedResponse.StickyExecutionEnabled = true
expectedResponse.NextEventId = msBuilder.GetNextEventID() + 1
expectedResponse.Attempt = di.Attempt
expectedResponse.Attempt = wt.Attempt
expectedResponse.WorkflowExecutionTaskQueue = &taskqueuepb.TaskQueue{
Name: executionInfo.TaskQueue,
Kind: enumspb.TASK_QUEUE_KIND_NORMAL,
Expand Down Expand Up @@ -909,9 +909,9 @@ func (s *engine2Suite) createExecutionStartedStateWithParent(
msBuilder := workflow.TestLocalMutableState(s.historyEngine.shard, s.mockEventsCache, tests.LocalNamespaceEntry,
s.logger, we.GetRunId())
addWorkflowExecutionStartedEventWithParent(msBuilder, we, "wType", tl, payloads.EncodeString("input"), 100*time.Second, 50*time.Second, 200*time.Second, parentInfo, identity)
di := addWorkflowTaskScheduledEvent(msBuilder)
wt := addWorkflowTaskScheduledEvent(msBuilder)
if startWorkflowTask {
addWorkflowTaskStartedEvent(msBuilder, di.ScheduledEventID, tl, identity)
addWorkflowTaskStartedEvent(msBuilder, wt.ScheduledEventID, tl, identity)
}
_ = msBuilder.SetHistoryTree(we.GetRunId())
versionHistory, _ := versionhistory.GetCurrentVersionHistory(
Expand Down Expand Up @@ -947,8 +947,8 @@ func (s *engine2Suite) TestRespondWorkflowTaskCompletedRecordMarkerCommand() {
msBuilder := workflow.TestLocalMutableState(s.historyEngine.shard, s.mockEventsCache, tests.LocalNamespaceEntry,
log.NewTestLogger(), we.GetRunId())
addWorkflowExecutionStartedEvent(msBuilder, we, "wType", tl, payloads.EncodeString("input"), 100*time.Second, 50*time.Second, 200*time.Second, identity)
di := addWorkflowTaskScheduledEvent(msBuilder)
addWorkflowTaskStartedEvent(msBuilder, di.ScheduledEventID, tl, identity)
wt := addWorkflowTaskScheduledEvent(msBuilder)
addWorkflowTaskStartedEvent(msBuilder, wt.ScheduledEventID, tl, identity)

commands := []*commandpb.Command{{
CommandType: enumspb.COMMAND_TYPE_RECORD_MARKER,
Expand Down Expand Up @@ -1002,8 +1002,8 @@ func (s *engine2Suite) TestRespondWorkflowTaskCompleted_StartChildWithSearchAttr
msBuilder := workflow.TestLocalMutableState(s.historyEngine.shard, s.mockEventsCache, tests.LocalNamespaceEntry,
log.NewTestLogger(), we.GetRunId())
addWorkflowExecutionStartedEvent(msBuilder, we, "wType", tl, nil, 100*time.Second, 50*time.Second, 200*time.Second, identity)
di := addWorkflowTaskScheduledEvent(msBuilder)
addWorkflowTaskStartedEvent(msBuilder, di.ScheduledEventID, tl, identity)
wt := addWorkflowTaskScheduledEvent(msBuilder)
addWorkflowTaskStartedEvent(msBuilder, wt.ScheduledEventID, tl, identity)

commands := []*commandpb.Command{{
CommandType: enumspb.COMMAND_TYPE_START_CHILD_WORKFLOW_EXECUTION,
Expand Down Expand Up @@ -1680,10 +1680,10 @@ func (s *engine2Suite) TestRecordChildExecutionCompleted() {
s.IsType(&serviceerror.NotFound{}, err)

// add child init event
di := addWorkflowTaskScheduledEvent(msBuilder)
workflowTasksStartEvent := addWorkflowTaskStartedEvent(msBuilder, di.ScheduledEventID, "testTaskQueue", uuid.New())
di.StartedEventID = workflowTasksStartEvent.GetEventId()
workflowTaskCompletedEvent := addWorkflowTaskCompletedEvent(msBuilder, di.ScheduledEventID, di.StartedEventID, "some random identity")
wt := addWorkflowTaskScheduledEvent(msBuilder)
workflowTasksStartEvent := addWorkflowTaskStartedEvent(msBuilder, wt.ScheduledEventID, "testTaskQueue", uuid.New())
wt.StartedEventID = workflowTasksStartEvent.GetEventId()
workflowTaskCompletedEvent := addWorkflowTaskCompletedEvent(msBuilder, wt.ScheduledEventID, wt.StartedEventID, "some random identity")

initiatedEvent, _ := addStartChildWorkflowExecutionInitiatedEvent(msBuilder, workflowTaskCompletedEvent.GetEventId(), uuid.New(),
tests.ChildNamespace, tests.ChildNamespaceID, childWorkflowID, childWorkflowType, childTaskQueueName, nil, 1*time.Second, 1*time.Second, 1*time.Second, enumspb.PARENT_CLOSE_POLICY_TERMINATE)
Expand Down Expand Up @@ -1860,10 +1860,10 @@ func (s *engine2Suite) TestVerifyChildExecutionCompletionRecorded_InitiatedEvent
WorkflowId: tests.WorkflowID,
RunId: tests.RunID,
}, "wType", taskQueueName, payloads.EncodeString("input"), 25*time.Second, 20*time.Second, 200*time.Second, "identity")
di := addWorkflowTaskScheduledEvent(msBuilder)
workflowTasksStartEvent := addWorkflowTaskStartedEvent(msBuilder, di.ScheduledEventID, taskQueueName, uuid.New())
di.StartedEventID = workflowTasksStartEvent.GetEventId()
workflowTaskCompletedEvent := addWorkflowTaskCompletedEvent(msBuilder, di.ScheduledEventID, di.StartedEventID, "some random identity")
wt := addWorkflowTaskScheduledEvent(msBuilder)
workflowTasksStartEvent := addWorkflowTaskStartedEvent(msBuilder, wt.ScheduledEventID, taskQueueName, uuid.New())
wt.StartedEventID = workflowTasksStartEvent.GetEventId()
workflowTaskCompletedEvent := addWorkflowTaskCompletedEvent(msBuilder, wt.ScheduledEventID, wt.StartedEventID, "some random identity")
initiatedEvent, ci := addStartChildWorkflowExecutionInitiatedEvent(msBuilder, workflowTaskCompletedEvent.GetEventId(), uuid.New(),
tests.ChildNamespace, tests.ChildNamespaceID, childWorkflowID, childWorkflowType, childTaskQueueName, nil, 1*time.Second, 1*time.Second, 1*time.Second, enumspb.PARENT_CLOSE_POLICY_TERMINATE)

Expand Down
10 changes: 5 additions & 5 deletions service/history/historyEngine3_eventsv2_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ func (s *engine3Suite) TestRecordWorkflowTaskStartedSuccessStickyEnabled() {
executionInfo.StickyTaskQueue = stickyTl

addWorkflowExecutionStartedEvent(msBuilder, we, "wType", tl, payloads.EncodeString("input"), 100*time.Second, 50*time.Second, 200*time.Second, identity)
di := addWorkflowTaskScheduledEvent(msBuilder)
wt := addWorkflowTaskScheduledEvent(msBuilder)

ms := workflow.TestCloneToProto(msBuilder)

Expand Down Expand Up @@ -215,12 +215,12 @@ func (s *engine3Suite) TestRecordWorkflowTaskStartedSuccessStickyEnabled() {
if executionInfo.LastWorkflowTaskStartedEventId != common.EmptyEventID {
expectedResponse.PreviousStartedEventId = executionInfo.LastWorkflowTaskStartedEventId
}
expectedResponse.ScheduledEventId = di.ScheduledEventID
expectedResponse.ScheduledTime = di.ScheduledTime
expectedResponse.StartedEventId = di.ScheduledEventID + 1
expectedResponse.ScheduledEventId = wt.ScheduledEventID
expectedResponse.ScheduledTime = wt.ScheduledTime
expectedResponse.StartedEventId = wt.ScheduledEventID + 1
expectedResponse.StickyExecutionEnabled = true
expectedResponse.NextEventId = msBuilder.GetNextEventID() + 1
expectedResponse.Attempt = di.Attempt
expectedResponse.Attempt = wt.Attempt
expectedResponse.WorkflowExecutionTaskQueue = &taskqueuepb.TaskQueue{
Name: executionInfo.TaskQueue,
Kind: enumspb.TASK_QUEUE_KIND_NORMAL,
Expand Down
Loading