Skip to content

Make the Cushion breaker public, cancellable, sizable and resettable - #52

Merged
arnelirobles merged 3 commits into
masterfrom
feature/45-cushion-public
Nov 14, 2026
Merged

arnelirobles merged 3 commits into
masterfrom
feature/45-cushion-public

Conversation

@arnelirobles

@arnelirobles arnelirobles commented Nov 14, 2026 •

Copy link
Copy Markdown
Contributor

The Cushion breaker can now be used on its own and tested without sleeping. It adds token-passing ShotAsync overloads so a Bounce timeout cancels the call, public Execute and ExecuteAsync, Cushion.MaxBreakers, Cushion.Reset(key) and CushionBuilder.WithClock, and docs/circuit-breaker.md. The one-key-one-settings rule is kept and documented (keying by settings would leave GetState(key) with no single answer). Existing tests build unchanged, so lambdas are unaffected. A method group with both M() and M(CancellationToken) overloads is now ambiguous and needs a lambda or a cast, as Carom.ShotAsync already requires. The first registration of a key fixes its clock, so use Cushion.Reset(key) to change it.

Closes #45

- test: tests/Carom.Extensions.Tests/PublicCushionTests.cs
  breaks: src/Carom.Extensions/Cushion.cs "if (value < 1)"
- test: tests/Carom.Extensions.Tests/PublicCushionTests.cs
  breaks: src/Carom.Extensions/CaromCushionExtensions.cs "return cushion.ExecuteAsync(() => global::Carom.Carom.ShotAsync(action, effective, ct));"

@coderabbitai

coderabbitai Bot commented Nov 14, 2026 •

Copy link
Copy Markdown

Explain Change →

Caution

Review failed

The pull request is closed.

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@arnelirobles
arnelirobles marked this pull request as ready for review November 14, 2026 01:42
@arnelirobles
arnelirobles merged commit ca680b6 into master Nov 14, 2026
1 check passed
@arnelirobles
arnelirobles deleted the feature/45-cushion-public branch November 14, 2026 01:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Cushion: a cancellable, public, sizable and resettable breaker

1 participant