Open
Description
The circuit breaker pattern as per the linked docs is to allow retrying of operations that are less likely to fail. With the current code in example/ if I encounter a 404, it'll just return the 404 HTML page and moreover without any operational context hence defeating the pattern aimed for :-(
gobreaker/example/http_breaker.go
Lines 26 to 55 in e7c4cd5
There should be a way in which the example HTTP circuit breaker looks at the returned HTTP status codes. There are some for which you should not retry unless some conditions change e.g. authorization and authentication problems, not found and legal issue status codes.
At bare minimum please make the example more resilient with error checking such as
defer res.Body.Close()
if res.StatusCode/100 != 2 { // Not a 2XX successful response
... // Handle the status code in here
}
Metadata
Assignees
Labels
No labels
Activity