Skip to content

Commit

Permalink
Fix noisy log (#917)
Browse files Browse the repository at this point in the history
* fix noisy log
  • Loading branch information
wxing1292 authored Jul 2, 2018
1 parent 492faf0 commit 3e7ac1a
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 6 deletions.
9 changes: 6 additions & 3 deletions host/client_integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,8 @@ func (s *clientIntegrationSuite) TestClientDataConverter() {
TaskList: s.taskList,
ExecutionStartToCloseTimeout: 60 * time.Second,
}
ctx, _ := context.WithTimeout(context.Background(), 60*time.Second)
ctx, cancel := context.WithTimeout(context.Background(), 60*time.Second)
defer cancel()
we, err := s.wfClient.ExecuteWorkflow(ctx, workflowOptions, testDataConverterWorkflow, tl)
if err != nil {
s.logger.Fatalf("Start workflow with err: %v", err)
Expand Down Expand Up @@ -313,7 +314,8 @@ func (s *clientIntegrationSuite) TestClientDataConverter_Failed() {
TaskList: s.taskList,
ExecutionStartToCloseTimeout: 60 * time.Second,
}
ctx, _ := context.WithTimeout(context.Background(), 60*time.Second)
ctx, cancel := context.WithTimeout(context.Background(), 60*time.Second)
defer cancel()
we, err := s.wfClient.ExecuteWorkflow(ctx, workflowOptions, testDataConverterWorkflow, tl)
if err != nil {
s.logger.Fatalf("Start workflow with err: %v", err)
Expand Down Expand Up @@ -414,7 +416,8 @@ func (s *clientIntegrationSuite) TestClientDataConverter_WithChild() {
TaskList: s.taskList,
ExecutionStartToCloseTimeout: 60 * time.Second,
}
ctx, _ := context.WithTimeout(context.Background(), 60*time.Second)
ctx, cancel := context.WithTimeout(context.Background(), 60*time.Second)
defer cancel()
we, err := s.wfClient.ExecuteWorkflow(ctx, workflowOptions, testParentWorkflow)
if err != nil {
s.logger.Fatalf("Start workflow with err: %v", err)
Expand Down
4 changes: 1 addition & 3 deletions host/integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ func (s *integrationSuite) setupSuite(enableGlobalDomain bool, isMasterCluster b
})
}

func (s *integrationSuite) TestIntegrationStartWorkflowExecution() {
func (s *integrationSuite) TestStartWorkflowExecution() {
id := "integration-start-workflow-test"
wt := "integration-start-workflow-test-type"
tl := "integration-start-workflow-test-tasklist"
Expand Down Expand Up @@ -544,7 +544,6 @@ func (s *integrationSuite) TestCompleteDecisionTaskAndCreateNewOne() {

s.logger.Infof("StartWorkflowExecution: response: %v \n", *we.RunId)

workflowComplete := false
decisionCount := 0
dtHandler := func(execution *workflow.WorkflowExecution, wt *workflow.WorkflowType,
previousStartedEventID, startedEventID int64, history *workflow.History) ([]byte, []*workflow.Decision, error) {
Expand All @@ -559,7 +558,6 @@ func (s *integrationSuite) TestCompleteDecisionTaskAndCreateNewOne() {
}}, nil
}

workflowComplete = true
return nil, []*workflow.Decision{{
DecisionType: common.DecisionTypePtr(workflow.DecisionTypeCompleteWorkflowExecution),
CompleteWorkflowExecutionDecisionAttributes: &workflow.CompleteWorkflowExecutionDecisionAttributes{
Expand Down
7 changes: 7 additions & 0 deletions service/history/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -936,6 +936,13 @@ func (h *Handler) convertError(err error) error {
return createShardOwnershipLostError(h.GetHostInfo().GetAddress(), info.GetAddress())
}
return createShardOwnershipLostError(h.GetHostInfo().GetAddress(), "")
case *persistence.WorkflowExecutionAlreadyStartedError:
err := err.(*persistence.WorkflowExecutionAlreadyStartedError)
return &gen.WorkflowExecutionAlreadyStartedError{
Message: common.StringPtr("Workflow is already running"),
StartRequestId: common.StringPtr(err.StartRequestID),
RunId: common.StringPtr(err.RunID),
}
}

return err
Expand Down
6 changes: 6 additions & 0 deletions service/history/historyEngine.go
Original file line number Diff line number Diff line change
Expand Up @@ -2048,6 +2048,12 @@ func (e *historyEngineImpl) SignalWithStartWorkflowExecution(ctx context.Context
return &workflow.StartWorkflowExecutionResponse{
RunId: common.StringPtr(resultRunID),
}, nil
} else if alreadyStartedErr, ok := err.(*persistence.WorkflowExecutionAlreadyStartedError); ok {
return nil, &workflow.WorkflowExecutionAlreadyStartedError{
Message: common.StringPtr("Workflow is already running"),
StartRequestId: common.StringPtr(alreadyStartedErr.StartRequestID),
RunId: common.StringPtr(alreadyStartedErr.RunID),
}
}
return nil, err
}
Expand Down
3 changes: 3 additions & 0 deletions service/history/historyReplicator.go
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,9 @@ func (r *historyReplicator) ApplyEvents(request *h.ReplicateEventsRequest) (retE
case *shared.WorkflowExecutionAlreadyStartedError:
logger.Debugf("Encounter WorkflowExecutionAlreadyStartedError: %v", retError)
retError = ErrRetryExecutionAlreadyStarted
case *persistence.WorkflowExecutionAlreadyStartedError:
logger.Debugf("Encounter WorkflowExecutionAlreadyStartedError: %v", retError)
retError = ErrRetryExecutionAlreadyStarted
}
}
}()
Expand Down

0 comments on commit 3e7ac1a

Please sign in to comment.