Skip to content

fix(async/unstable): evaluate circuit breaker failure rate on success - #7308

Open
tomas-zijdemans wants to merge 1 commit into
denoland:mainfrom
tomas-zijdemans:fix-cb-evaluate-on-success
Open

fix(async/unstable): evaluate circuit breaker failure rate on success#7308
tomas-zijdemans wants to merge 1 commit into
denoland:mainfrom
tomas-zijdemans:fix-cb-evaluate-on-success

Conversation

@tomas-zijdemans

@tomas-zijdemans tomas-zijdemans commented Sep 6, 2026

Copy link
Copy Markdown
Contributor

A success in closed state returned before the failure rate was checked. When that success was the request that lifted the window to minimumThroughput, the circuit stayed closed even though the rate already qualified. With minimumThroughput: 3 and failureRateThreshold: 0.5, failure, failure, success left the circuit closed at a 67% failure rate. The docs say it opens.

Closed-state successes now run the same rate check as failures, and open the circuit with the usual onStateChange and onOpen callbacks when it qualifies. The check is factored into one helper so both paths agree.

One test covers the trip, one covers a success that keeps the rate below the threshold.

@github-actions github-actions Bot added the async label Sep 6, 2026
@codecov

codecov Bot commented Sep 6, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 95.03%. Comparing base (ca58f94) to head (0a4f638).

Additional details and impacted files
@@           Coverage Diff            @@
##             main    #7308    +/-   ##
========================================
  Coverage   95.03%   95.03%            
========================================
  Files         617      618     +1     
  Lines       51637    51909   +272     
  Branches     9359     9412    +53     
========================================
+ Hits        49075    49334   +259     
- Misses       2021     2030     +9     
- Partials      541      545     +4     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant