Skip to content

Commit fee93b1

Browse files
committed
Use DO SLEEP to clear the kill flag.
1 parent 5ac36f3 commit fee93b1

File tree

1 file changed

+2
-10
lines changed

1 file changed

+2
-10
lines changed

src/MySqlConnector/MySqlClient/MySqlDataReader.cs

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -293,16 +293,8 @@ private void DoClose()
293293
// KILL QUERY will kill a subsequent query if the command it was intended to cancel has already completed.
294294
// In order to handle this case, we issue a dummy query to catch the QueryInterrupted exception.
295295
// See https://bugs.mysql.com/bug.php?id=45679
296-
var killClearCommand = new MySqlCommand("SELECT * FROM fake_table LIMIT 0;", connection);
297-
try
298-
{
299-
killClearCommand.ExecuteReader();
300-
}
301-
catch (MySqlException ex)
302-
{
303-
if (ex.Number != (int) MySqlErrorCode.QueryInterrupted && ex.Number != (int) MySqlErrorCode.NoSuchTable)
304-
throw;
305-
}
296+
var killClearCommand = new MySqlCommand("DO SLEEP(0);", connection);
297+
killClearCommand.ExecuteNonQuery();
306298
}
307299

308300
Command.ReaderClosed();

0 commit comments

Comments
 (0)