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

Stop retry flow for error handling (conditional trigger) #12032

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -286,11 +286,11 @@ func (s *streams) handleErrCode(result *ocr2keepers.CheckResult, errCode encodin
return nil, err
}
case types.ConditionTrigger:
// switch errCode {
// case encoding.ErrCodePartialContent, encoding.ErrCodeDataStreamsError, encoding.ErrCodeBadRequest, encoding.ErrCodeUnauthorized, encoding.ErrCodeEncodingError:
// default:
// return nil, err // TODO: encomment this line once we have error handler
// }
switch errCode {
case encoding.ErrCodePartialContent, encoding.ErrCodeDataStreamsError, encoding.ErrCodeBadRequest, encoding.ErrCodeUnauthorized, encoding.ErrCodeEncodingError:
default:
return nil, err
}
default:
return nil, err
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -836,7 +836,7 @@ func Test_HandleErrCode(t *testing.T) {
expectedErr error
}{
{
name: "no error",
name: "log trigger no error",
checkResult: &ocr2keepers.CheckResult{
UpkeepID: core.GenUpkeepID(clatypes.LogTrigger, "111"),
},
Expand All @@ -846,7 +846,17 @@ func Test_HandleErrCode(t *testing.T) {
expectedErr: nil,
},
{
name: "error code bad request",
name: "conditional trigger no error",
checkResult: &ocr2keepers.CheckResult{
UpkeepID: core.GenUpkeepID(clatypes.ConditionTrigger, "222"),
},
errCode: encoding.ErrCodeNil,
err: nil,
expectedValues: [][]byte{},
expectedErr: nil,
},
{
name: "log trigger error code bad request",
checkResult: &ocr2keepers.CheckResult{
UpkeepID: core.GenUpkeepID(clatypes.LogTrigger, "111"),
},
Expand All @@ -856,7 +866,17 @@ func Test_HandleErrCode(t *testing.T) {
expectedErr: nil,
},
{
name: "error code partial content with retry timeout",
name: "conditional trigger bad request",
checkResult: &ocr2keepers.CheckResult{
UpkeepID: core.GenUpkeepID(clatypes.ConditionTrigger, "222"),
},
errCode: encoding.ErrCodeBadRequest,
err: errors.New("400"),
expectedValues: [][]byte{},
expectedErr: nil,
},
{
name: "log trigger error code partial content with retry timeout",
checkResult: &ocr2keepers.CheckResult{
UpkeepID: core.GenUpkeepID(clatypes.LogTrigger, "111"),
RetryInterval: mercury.RetryIntervalTimeout,
Expand All @@ -868,7 +888,7 @@ func Test_HandleErrCode(t *testing.T) {
expectedErr: nil,
},
{
name: "error code partial content without retry timeout",
name: "log trigger error code partial content without retry timeout",
checkResult: &ocr2keepers.CheckResult{
UpkeepID: core.GenUpkeepID(clatypes.LogTrigger, "111"),
RetryInterval: time.Second,
Expand All @@ -879,6 +899,18 @@ func Test_HandleErrCode(t *testing.T) {
expectedValues: nil,
expectedErr: partialContentErr,
},
{
name: "conditional trigger partial content",
checkResult: &ocr2keepers.CheckResult{
UpkeepID: core.GenUpkeepID(clatypes.ConditionTrigger, "222"),
RetryInterval: time.Second,
Retryable: true,
},
errCode: encoding.ErrCodePartialContent,
err: errors.New("206"),
expectedValues: [][]byte{},
expectedErr: nil,
},
}

for _, tt := range tests {
Expand Down
Loading