Skip to content

Commit 30173ab

Browse files
committed
Treat ClearingPendingCancellation as valid case for command cancellation
Signed-off-by: Viktor Svyatokha <[email protected]>
1 parent a5af030 commit 30173ab

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/MySqlConnector/Core/ServerSession.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ public bool TryStartCancel(ICancellableCommand command)
9696
{
9797
if (ActiveCommandId != command.CommandId)
9898
return false;
99-
VerifyState(State.Querying, State.CancelingQuery, State.Failed);
99+
VerifyState(State.Querying, State.CancelingQuery, State.ClearingPendingCancellation, State.Failed);
100100
if (m_state != State.Querying)
101101
return false;
102102
if (command.CancelAttemptCount++ >= 10)
@@ -1746,9 +1746,9 @@ private void VerifyState(State state)
17461746
}
17471747
}
17481748

1749-
private void VerifyState(State state1, State state2, State state3)
1749+
private void VerifyState(State state1, State state2, State state3, State state4)
17501750
{
1751-
if (m_state != state1 && m_state != state2 && m_state != state3)
1751+
if (m_state != state1 && m_state != state2 && m_state != state3 && m_state != state4)
17521752
{
17531753
Log.Error("Session{0} should have SessionStateExpected {1} or SessionStateExpected2 {2} or SessionStateExpected3 {3} but was SessionState {4}", m_logArguments[0], state1, state2, state3, m_state);
17541754
throw new InvalidOperationException("Expected state to be ({0}|{1}|{2}) but was {3}.".FormatInvariant(state1, state2, state3, m_state));

0 commit comments

Comments
 (0)