Skip to content

Commit 51f265a

Browse files
committed
Remove CommandTimeoutExpired as transient. Fixes #940
1 parent 1268dab commit 51f265a

File tree

2 files changed

+6
-8
lines changed

2 files changed

+6
-8
lines changed

src/MySqlConnector/MySqlException.cs

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -126,13 +126,12 @@ internal MySqlException(MySqlErrorCode errorCode, string? sqlState, string messa
126126
internal static MySqlException CreateForTimeout(Exception? innerException) =>
127127
new(MySqlErrorCode.CommandTimeoutExpired, "The Command Timeout expired before the operation completed.", innerException);
128128

129-
private static bool IsErrorTransient(MySqlErrorCode errorCode) =>
130-
errorCode is MySqlErrorCode.CommandTimeoutExpired
131-
or MySqlErrorCode.ConnectionCountError
132-
or MySqlErrorCode.LockDeadlock
133-
or MySqlErrorCode.LockWaitTimeout
134-
or MySqlErrorCode.UnableToConnectToHost
135-
or MySqlErrorCode.XARBDeadlock;
129+
private static bool IsErrorTransient(MySqlErrorCode errorCode) => errorCode
130+
is MySqlErrorCode.ConnectionCountError
131+
or MySqlErrorCode.LockDeadlock
132+
or MySqlErrorCode.LockWaitTimeout
133+
or MySqlErrorCode.UnableToConnectToHost
134+
or MySqlErrorCode.XARBDeadlock;
136135

137136
IDictionary? m_data;
138137
}

tests/MySqlConnector.Tests/CancellationTests.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,6 @@ public void Test(int step, int method)
224224
var ex = Assert.Throws<MySqlException>(() => s_executeMethods[method](command));
225225
Assert.InRange(stopwatch.ElapsedMilliseconds, 2900, 3500);
226226
Assert.Equal(MySqlErrorCode.CommandTimeoutExpired, ex.ErrorCode);
227-
Assert.True(ex.IsTransient);
228227
Assert.Null(ex.InnerException);
229228

230229
// connection is unusable

0 commit comments

Comments
 (0)