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

Calculated break duration for Circuit breaker #1715

Closed
wants to merge 0 commits into from

Conversation

atawLee
Copy link
Contributor

@atawLee atawLee commented Oct 22, 2023

Pull Request

The issue or feature being addressed

#653

Details on the issue fix or feature implementation

  • Added a FailureCount get property to CircuitBehavior to retrieve the count of failures.
  • Introduced a private readonly field _breakDurationGenerator of type Func<int, TimeSpan> to CircuitStateController for dynamic break duration generation.
  • Enhanced the constructor of CircuitStateController with an overload to accommodate _breakDurationGenerator.
  • Incorporated FailureCount into HealthInfo.
  • Updated OpenCircuitFor_NeedsLock to assign the _blockedUntil value based on both the presence of breakDuration and the number of failures.

Confirm the following

  • I started this PR by branching from the head of the default branch
  • I have targeted the PR to merge into the default branch
  • I have included unit tests for the issue/feature
  • I have successfully run a local build

@atawLee
Copy link
Contributor Author

atawLee commented Oct 22, 2023

@dotnet-policy-service agree

@peter-csala
Copy link
Contributor

Please also update the related anti-pattern under the circuit breaker docs.

docs/strategies/circuit-breaker.md Outdated Show resolved Hide resolved
docs/strategies/circuit-breaker.md Outdated Show resolved Hide resolved
docs/strategies/circuit-breaker.md Outdated Show resolved Hide resolved
Copy link
Member

@martincostello martincostello left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please run the build locally and fix the analyser warnings that are reported to you, such as code formatting issues and the Public API Analyser warnings. Opening the code with Visual Studio should provide you with gestures on the analyzer warnings to automatically update the appropriate files.

@martincostello
Copy link
Member

The build is now complaining about not all of the changes' code paths being covered by a test.

You can use the coverage report attached to the build artifacts to take a look at what is missing.

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.

None yet

4 participants