File tree Expand file tree Collapse file tree 2 files changed +17
-1
lines changed Expand file tree Collapse file tree 2 files changed +17
-1
lines changed Original file line number Diff line number Diff line change @@ -25,6 +25,7 @@ To be included in 1.0.0 (unreleased)
25
25
* Add rsa extras_require depending on PyMySQL[rsa] #557
26
26
* Migrate to PEP 517 build system #746
27
27
* Self-reported `__version__` now returns version generated by `setuptools-scm` during build, otherwise `'unknown'` #748
28
+ * Fix SSCursor raising query timeout error on wrong query #428
28
29
29
30
30
31
0.0.22 (2021-11-14)
Original file line number Diff line number Diff line change @@ -1247,7 +1247,22 @@ async def _finish_unbuffered_query(self):
1247
1247
# in fact, no way to stop MySQL from sending all the data after
1248
1248
# executing a query, so we just spin, and wait for an EOF packet.
1249
1249
while self .unbuffered_active :
1250
- packet = await self .connection ._read_packet ()
1250
+ try :
1251
+ packet = await self .connection ._read_packet ()
1252
+ except OperationalError as e :
1253
+ # TODO: replace these numbers with constants when available
1254
+ # TODO: in a new PyMySQL release
1255
+ if e .args [0 ] in (
1256
+ 3024 , # ER.QUERY_TIMEOUT
1257
+ 1969 , # ER.STATEMENT_TIMEOUT
1258
+ ):
1259
+ # if the query timed out we can simply ignore this error
1260
+ self .unbuffered_active = False
1261
+ self .connection = None
1262
+ return
1263
+
1264
+ raise
1265
+
1251
1266
if self ._check_packet_is_eof (packet ):
1252
1267
self .unbuffered_active = False
1253
1268
# release reference to kill cyclic reference.
You can’t perform that action at this time.
0 commit comments