Skip to content

Commit 2830f38

Browse files
yimincdnr
authored andcommitted
Do not use Unvailable as error type for expected error cases (#4650)
<!-- Describe what has changed in this PR --> **What changed?** Do not use Unavailable error type for expected error cases. <!-- Tell your future self why have you made these changes --> **Why?** To correctly reflect the error case. <!-- How have you verified this change? Tested locally? Added a unit test? Checked in staging env? --> **How did you test it?** eye_balls <!-- Assuming the worst case, what can be broken when deploying this change to production? --> **Potential risks** No <!-- Is this PR a hotfix candidate or require that a notification be sent to the broader community? (Yes/No) --> **Is hotfix candidate?** No
1 parent a9a9acb commit 2830f38

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

service/history/consts/const.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,13 +70,13 @@ var (
7070
// ErrSignalsLimitExceeded is the error indicating limit reached for maximum number of signal events
7171
ErrSignalsLimitExceeded = serviceerror.NewInvalidArgument("exceeded workflow execution limit for signal events")
7272
// ErrWorkflowClosing is the error indicating requests to workflow got rejected due to workflow is closing
73-
ErrWorkflowClosing = serviceerror.NewUnavailable("workflow operation rejected because workflow is closing")
73+
ErrWorkflowClosing = serviceerror.NewWorkflowNotReady("workflow operation rejected because workflow is closing")
7474
// ErrEventsAterWorkflowFinish is the error indicating server error trying to write events after workflow finish event
7575
ErrEventsAterWorkflowFinish = serviceerror.NewInternal("error validating last event being workflow finish event")
7676
// ErrQueryEnteredInvalidState is error indicating query entered invalid state
7777
ErrQueryEnteredInvalidState = serviceerror.NewInvalidArgument("query entered invalid state, this should be impossible")
7878
// ErrConsistentQueryBufferExceeded is error indicating that too many consistent queries have been buffered and until buffered queries are finished new consistent queries cannot be buffered
79-
ErrConsistentQueryBufferExceeded = serviceerror.NewUnavailable("consistent query buffer is full, cannot accept new consistent queries")
79+
ErrConsistentQueryBufferExceeded = serviceerror.NewWorkflowNotReady("consistent query buffer is full, this may be caused by too many queries and workflow not able to process query fast enough")
8080
// ErrEmptyHistoryRawEventBatch indicate that one single batch of history raw events is of size 0
8181
ErrEmptyHistoryRawEventBatch = serviceerror.NewInvalidArgument("encountered empty history batch")
8282
// ErrHistorySizeExceedsLimit is error indicating workflow execution has exceeded system defined history size limit

tests/signal_workflow_test.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ import (
4040
"go.temporal.io/api/serviceerror"
4141
taskqueuepb "go.temporal.io/api/taskqueue/v1"
4242
"go.temporal.io/api/workflowservice/v1"
43+
"go.temporal.io/server/service/history/consts"
4344

4445
"go.temporal.io/server/common/convert"
4546
"go.temporal.io/server/common/log/tag"
@@ -853,7 +854,7 @@ func (s *integrationSuite) TestSignalWorkflow_WorkflowCloseAttempted() {
853854
RequestId: uuid.New(),
854855
})
855856
s.Error(err)
856-
s.IsType(&serviceerror.Unavailable{}, err)
857+
s.Error(consts.ErrWorkflowClosing, err)
857858
}
858859

859860
attemptCount++

0 commit comments

Comments
 (0)