Skip to content

Commit

Permalink
Addressing PR-4099 comments (#4113)
Browse files Browse the repository at this point in the history
  • Loading branch information
samanbarghi committed Mar 29, 2023
1 parent f1b88e8 commit f4c1888
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion service/history/api/queryworkflow/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ func Invoke(
return nil, consts.ErrWorkflowTaskNotScheduled
}

if mutableState.GetExecutionInfo().WorkflowTaskAttempt > 1 {
if mutableState.IsTransientWorkflowTask() {
// while workflow task is failing, the query to that workflow will also fail. Failing fast here to prevent wasting
// resources to load history for a query that will fail.
return nil, serviceerror.NewFailedPrecondition("Cannot query workflow due to Workflow Task in failed state.")
Expand Down
5 changes: 3 additions & 2 deletions tests/query_workflow_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@ func (s *clientIntegrationSuite) TestQueryWorkflow_QueryFailedWorkflowTask() {
})

if err != nil {
s.Logger.Fatal("SetQueryHandler failed: " + err.Error())
s.T().Fatalf("SetQueryHandler failed: %s", err.Error())
}
// force workflow task to fail
panic("Workflow failed")
Expand All @@ -292,7 +292,8 @@ func (s *clientIntegrationSuite) TestQueryWorkflow_QueryFailedWorkflowTask() {
s.True(workflowRun.GetRunID() != "")

// wait for workflow to fail
time.Sleep(time.Second * 5)
time.Sleep(time.Second * 2)
_, err = s.sdkClient.QueryWorkflow(ctx, id, "", "test")
s.Error(err)
s.IsType(&serviceerror.FailedPrecondition{}, err)
}

0 comments on commit f4c1888

Please sign in to comment.