Skip to content
Snippets Groups Projects
Commit 2ffff180 authored by Sybren A. Stüvel's avatar Sybren A. Stüvel
Browse files

Prevent 'sqlite3.OperationalError: cannot VACUUM from within a transaction' on Windows

parent 610be3da
No related branches found
No related tags found
No related merge requests found
......@@ -33,7 +33,7 @@ class TaskUpdateQueue:
def _connect_db(self):
self._log.info('Connecting to database %s', self.db_fname)
self._db = sqlite3.connect(self.db_fname)
self._db = sqlite3.connect(self.db_fname, isolation_level=None)
# We don't need to create a primary key; we use the implicit 'rowid' column.
self._db.execute('CREATE TABLE IF NOT EXISTS fworker_queue(url TEXT, payload BLOB)')
......@@ -41,6 +41,9 @@ class TaskUpdateQueue:
# Start with a more-or-less compact database.
self._db.execute('VACUUM')
# Now that that is out of the way, we can use the default SQLite behaviour again.
self._db.isolation_level = ''
def _disconnect_db(self):
self._log.info('Disconnecting from database %s', self.db_fname)
self._db.close()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment