Skip to content

Commit

Permalink
Don't return BUSY_WORKFLOW on polls (#7197)
Browse files Browse the repository at this point in the history
## What changed?
Follow-up from #7093: exclude `RESOURCE_EXHAUSTED_CAUSE_BUSY_WORKFLOW`
from early return to client.

## Why?
Busy workflow is really a "workflow" scope error, not namespace or
system scope, so the argument that we shouldn't retry immediately
doesn't apply.

## How did you test it?
there weren't specific tests for this
  • Loading branch information
dnr authored Jan 31, 2025
1 parent cccd932 commit 7d2da81
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions service/matching/matching_engine.go
Original file line number Diff line number Diff line change
Expand Up @@ -652,7 +652,7 @@ pollLoop:
}
resp, err := e.recordWorkflowTaskStarted(ctx, requestClone, task)
if err != nil {
switch err.(type) {
switch err := err.(type) {
case *serviceerror.Internal, *serviceerror.DataLoss:
if e.config.MatchingDropNonRetryableTasks() {
e.nonRetryableErrorsDropTask(task, taskQueueName, err)
Expand Down Expand Up @@ -707,8 +707,11 @@ pollLoop:
case *serviceerror.ResourceExhausted:
// If history returns one ResourceExhausted, it's likely to return more if we retry
// immediately. Instead, return the error to the client which will back off.
// BUSY_WORKFLOW is limited to one workflow and is okay to retry.
task.finish(err, false)
return nil, err
if err.Cause != enumspb.RESOURCE_EXHAUSTED_CAUSE_BUSY_WORKFLOW {
return nil, err
}
default:
task.finish(err, false)
if err.Error() == common.ErrNamespaceHandover.Error() {
Expand Down Expand Up @@ -842,7 +845,7 @@ pollLoop:
}
resp, err := e.recordActivityTaskStarted(ctx, requestClone, task)
if err != nil {
switch err.(type) {
switch err := err.(type) {
case *serviceerror.Internal, *serviceerror.DataLoss:
if e.config.MatchingDropNonRetryableTasks() {
e.nonRetryableErrorsDropTask(task, taskQueueName, err)
Expand Down Expand Up @@ -910,8 +913,11 @@ pollLoop:
case *serviceerror.ResourceExhausted:
// If history returns one ResourceExhausted, it's likely to return more if we retry
// immediately. Instead, return the error to the client which will back off.
// BUSY_WORKFLOW is limited to one workflow and is okay to retry.
task.finish(err, false)
return nil, err
if err.Cause != enumspb.RESOURCE_EXHAUSTED_CAUSE_BUSY_WORKFLOW {
return nil, err
}
default:
task.finish(err, false)
if err.Error() == common.ErrNamespaceHandover.Error() {
Expand Down

0 comments on commit 7d2da81

Please sign in to comment.