mirror of
https://github.com/simonw/datasette.git
synced 2025-12-10 16:51:24 +01:00
Ensure sqlite_timelimit correctly clears handler
If an error occurred inside the block the progress handler (used to enforce a time limit) was not being correctly cleared, resulting in timeout errors potentially occurring during subsequent SQL queries. The fix is described here: https://docs.python.org/3/library/contextlib.html#contextlib.contextmanager
This commit is contained in:
parent
11b352b4d5
commit
bac4e01f40
1 changed files with 4 additions and 2 deletions
|
|
@ -152,8 +152,10 @@ def sqlite_timelimit(conn, ms):
|
|||
return 1
|
||||
|
||||
conn.set_progress_handler(handler, n)
|
||||
yield
|
||||
conn.set_progress_handler(None, n)
|
||||
try:
|
||||
yield
|
||||
finally:
|
||||
conn.set_progress_handler(None, n)
|
||||
|
||||
|
||||
class InvalidSql(Exception):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue