Skip to content

Commit

Permalink
task: Make 4xx errors from Catalyst unretriable (#175)
Browse files Browse the repository at this point in the history
* task: Make 4xx errors from Catalyst unretriable

This is to improve our error classification and both
not retry as well as not alert from user-input errors
on the request to Catalyst (normally bad input URLs).

* clients: Remove error forcing, return RateLimited instead
  • Loading branch information
victorges authored Mar 24, 2023
1 parent ededb39 commit b112d74
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
6 changes: 6 additions & 0 deletions clients/catalyst.go
Original file line number Diff line number Diff line change
Expand Up @@ -164,3 +164,9 @@ func isTooManyRequestsErr(err error) bool {
var statusErr *HTTPStatusError
return errors.As(err, &statusErr) && statusErr.Status == http.StatusTooManyRequests
}

func IsInputError(err error) bool {
var statusErr *HTTPStatusError
return errors.As(err, &statusErr) &&
(statusErr.Status >= 400 && statusErr.Status < 500)
}
2 changes: 2 additions & 0 deletions task/upload.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,8 @@ func handleUploadVOD(p handleUploadVODParams) (*TaskHandlerOutput, error) {
err = tctx.catalyst.UploadVOD(ctx, req)
if errors.Is(err, clients.ErrRateLimited) {
nextStep = "rateLimitBackoff"
} else if clients.IsInputError(err) {
return nil, UnretriableError{fmt.Errorf("input error on catalyst request: %w", err)}
} else if err != nil {
return nil, fmt.Errorf("failed to call catalyst: %w", err)
}
Expand Down

0 comments on commit b112d74

Please sign in to comment.