Skip to content

Commit

Permalink
Brought back a condition check in the lock (App-vNext#1290)
Browse files Browse the repository at this point in the history
  • Loading branch information
IgorIgorevich94 committed Aug 26, 2023
1 parent 59b6133 commit d8ccdd8
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/Polly/CircuitBreaker/CircuitStateController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,13 @@ public CircuitState CircuitState

using var _ = TimedLock.Lock(_lock);

if (!IsInAutomatedBreak_NeedsLock)
#pragma warning disable CA1508 // Avoid dead conditional code. _circuitState is checked again in the lock
if (_circuitState == CircuitState.Open && !IsInAutomatedBreak_NeedsLock)
{
_circuitState = CircuitState.HalfOpen;
_onHalfOpen();
}
#pragma warning restore CA1508 // Avoid dead conditional code. _circuitState is checked again in the lock

return _circuitState;
}
Expand Down

0 comments on commit d8ccdd8

Please sign in to comment.