Skip to content
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

Support NewCustomError that doesn't always retry #1083

Open
peaaceChoi opened this issue Apr 13, 2021 · 0 comments
Open

Support NewCustomError that doesn't always retry #1083

peaaceChoi opened this issue Apr 13, 2021 · 0 comments

Comments

@peaaceChoi
Copy link

Is your feature request related to a problem? Please describe.

NonRetriableErrorReasons are supposed to cadence errors in all cases where retry is not required. However, Activity has many conditions that do not need to be retried.
If validation for input fails as in the example below, there is no need to retry. This is because the same error is repeated.

RetryPolicy: &cadence.RetryPolicy{
			InitialInterval:          time.Second,
			BackoffCoefficient:       2.0,
			MaximumInterval:          time.Minute,
			ExpirationInterval:       time.Minute * 10,
			NonRetriableErrorReasons: []string{"ErrInvalidInput01",
			"ErrInvalidInput02",
			"ErrInvalidInput03",...},
		},

The problem is, if there is a large number of errors such as input validation, the NonRetriableErrorReasons must be described in all retry policy.

Proposed Solution

It can be solved in various ways, but I think it will be the simplest to add the noRetry related function to the newCustomError of the cadence client.
the user is not required to use Non Retriable Error Reasons if can identify specific errors by using the prefix of the new custom errors as shown below.

func NewCustomErrorWithNoRetry(reason string, details ...interface{}) *CustomError {
	return internal.NewCustomError("cadenceInternal:NoRetry:"+reason, details...)
}

Justly, need to modify the decision codes below.

cadence
https://github.com/uber/cadence/blob/7bd91051360214181464b87325615631a1712bb7/service/history/execution/retry.go#L83-L87

cadence client

for _, er := range p.NonRetriableErrorReasons {
if er == errReason {
return noRetryBackoff
}
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant