Skip to content
Permalink
Browse files

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
  • Loading branch information...
simonw committed Apr 21, 2019
1 parent 11b352b commit bac4e01f40ae7bd19d1eab1fb9349452c18de8f5
Showing with 4 additions and 2 deletions.
  1. +4 −2 datasette/utils.py
@@ -152,8 +152,10 @@ def handler():
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):

0 comments on commit bac4e01

Please sign in to comment.
You can’t perform that action at this time.