-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Expose poller error on max deployments instead of masking it as internal #8785
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -5,6 +5,7 @@ import ( | |
| "errors" | ||
| "fmt" | ||
| "math/rand/v2" | ||
| "strings" | ||
| "sync" | ||
| "sync/atomic" | ||
| "time" | ||
|
|
@@ -30,6 +31,7 @@ import ( | |
| "go.temporal.io/server/common/testing/testhooks" | ||
| "go.temporal.io/server/common/worker_versioning" | ||
| "go.temporal.io/server/service/matching/counter" | ||
| "go.temporal.io/server/service/worker/workerdeployment" | ||
| "google.golang.org/protobuf/types/known/durationpb" | ||
| ) | ||
|
|
||
|
|
@@ -725,6 +727,9 @@ func (c *physicalTaskQueueManagerImpl) ensureRegisteredInDeploymentVersion( | |
| } | ||
| var errResourceExhausted *serviceerror.ResourceExhausted | ||
| if !errors.As(err, &errResourceExhausted) { | ||
| if strings.Contains(err.Error(), workerdeployment.ErrTooManyDeploymentsInNamespacePrefix) { | ||
| return err | ||
| } | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Bug: Unreachable code: check is inside wrong conditional branchThe new check for |
||
| // Do not surface low level error to user | ||
| c.logger.Error("error while registering version", tag.Error(err)) | ||
| err = errDeploymentVersionNotReady | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bug: Unreachable code: check is inside wrong conditional branch
The new check for
ErrTooManyDeploymentsInNamespacePrefixis placed inside theif !errors.As(err, &errResourceExhausted)block, meaning it only executes when the error is NOT a*serviceerror.ResourceExhausted. However, the "too many deployments" error is created vianewResourceExhaustedError()which returns a*serviceerror.ResourceExhausted. Therefore,errors.Aswill returntruefor this error, the condition!errors.As(...)will befalse, and this new code block will never execute for the intended error case. The check needs to be moved outside or before the!errors.Asconditional.