File tree 2 files changed +16
-1
lines changed 2 files changed +16
-1
lines changed Original file line number Diff line number Diff line change 4
4
5
5
Release date: TBD
6
6
7
+ * Fixed SSCursor raising OperationalError for query timeouts on wrong statement (#1032 )
7
8
* Exposed ` Cursor.warning_count ` to check for warnings without additional query (#1056 )
8
9
10
+
9
11
## v1.0.3
10
12
11
13
Release date: TBD
Original file line number Diff line number Diff line change @@ -1262,7 +1262,20 @@ def _finish_unbuffered_query(self):
1262
1262
# in fact, no way to stop MySQL from sending all the data after
1263
1263
# executing a query, so we just spin, and wait for an EOF packet.
1264
1264
while self .unbuffered_active :
1265
- packet = self .connection ._read_packet ()
1265
+ try :
1266
+ packet = self .connection ._read_packet ()
1267
+ except err .OperationalError as e :
1268
+ if e .args [0 ] in (
1269
+ ER .QUERY_TIMEOUT ,
1270
+ ER .STATEMENT_TIMEOUT ,
1271
+ ):
1272
+ # if the query timed out we can simply ignore this error
1273
+ self .unbuffered_active = False
1274
+ self .connection = None
1275
+ return
1276
+
1277
+ raise
1278
+
1266
1279
if self ._check_packet_is_eof (packet ):
1267
1280
self .unbuffered_active = False
1268
1281
self .connection = None # release reference to kill cyclic reference.
You can’t perform that action at this time.
0 commit comments