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)
2525* Add rsa extras_require depending on PyMySQL[rsa] #557
2626* Migrate to PEP 517 build system #746
2727* 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
2829
2930
30310.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):
12471247 # in fact, no way to stop MySQL from sending all the data after
12481248 # executing a query, so we just spin, and wait for an EOF packet.
12491249 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+
12511266 if self ._check_packet_is_eof (packet ):
12521267 self .unbuffered_active = False
12531268 # release reference to kill cyclic reference.
You can’t perform that action at this time.
0 commit comments