From 3a78be98418e1c987bcdd7c2e82f9625106bdc2e Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 28 Jun 2024 08:01:25 +0000 Subject: [PATCH] Bump SonarAnalyzer.CSharp from 9.27.0.93347 to 9.28.0.94264 (#2167) * Bump SonarAnalyzer.CSharp from 9.27.0.93347 to 9.28.0.94264 Bumps [SonarAnalyzer.CSharp](https://github.com/SonarSource/sonar-dotnet) from 9.27.0.93347 to 9.28.0.94264. - [Release notes](https://github.com/SonarSource/sonar-dotnet/releases) - [Commits](https://github.com/SonarSource/sonar-dotnet/compare/9.27.0.93347...9.28.0.94264) --- updated-dependencies: - dependency-name: SonarAnalyzer.CSharp dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] * Fix S1871 warning Combine duplicate code blocks. --------- Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Martin Costello --- Directory.Packages.props | 2 +- .../CircuitBreaker/Controller/CircuitStateController.cs | 6 +----- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/Directory.Packages.props b/Directory.Packages.props index c928162cba..3f3e3ad32b 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -36,7 +36,7 @@ - + diff --git a/src/Polly.Core/CircuitBreaker/Controller/CircuitStateController.cs b/src/Polly.Core/CircuitBreaker/Controller/CircuitStateController.cs index e8b37c2240..40dd2c5e35 100644 --- a/src/Polly.Core/CircuitBreaker/Controller/CircuitStateController.cs +++ b/src/Polly.Core/CircuitBreaker/Controller/CircuitStateController.cs @@ -209,11 +209,7 @@ public ValueTask OnHandledOutcomeAsync(Outcome outcome, ResilienceContext con // the metric; we do not want to duplicate-signal onBreak; we do not want to extend time for which the circuit is broken. // We do not want to mask the fact that the call executed (as replacing its result with a Broken/IsolatedCircuitException would do). - if (_circuitState == CircuitState.HalfOpen) - { - OpenCircuit_NeedsLock(outcome, manual: false, context, out task); - } - else if (_circuitState == CircuitState.Closed && shouldBreak) + if (_circuitState == CircuitState.HalfOpen || (_circuitState == CircuitState.Closed && shouldBreak)) { OpenCircuit_NeedsLock(outcome, manual: false, context, out task); }