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

httpbp: Fix CircuitBreaker #428

Merged
merged 1 commit into from
Sep 23, 2021
Merged

httpbp: Fix CircuitBreaker #428

merged 1 commit into from
Sep 23, 2021

Commits on Sep 23, 2021

  1. httpbp: Fix CircuitBreaker

    Fix one bug: when status code >= 500 and closing the body does not error
    (it won't error in majority of cases), we do not actually report error
    to the circuit breaker.
    
    Also fix a few inefficiencies:
    
    1. When loaded is true, newBreaker is not used, so we can return it back
       to the pool immediately, instead of defer'd.
    2. Use DrainAndClose instead of ReadAll and Close, as
       io.Copy(io.Discard) is more efficient than ReadAll.
    3. Use pointer for the breaker in the pool and the map.
    
    Also avoid dealing with interface{} from breaker.Execute, and add a test
    to CircuitBreaker.
    fishy committed Sep 23, 2021
    Configuration menu
    Copy the full SHA
    5aaf3df View commit details
    Browse the repository at this point in the history