fix(db): fix bug with releasing without lock in db.clean()

This commit is contained in:
psychedelicious 2023-12-05 06:48:53 +11:00
parent 7d4a78e470
commit 10cf10c16c

View File

@ -31,6 +31,7 @@ class SqliteDatabase:
self.conn.execute("PRAGMA foreign_keys = ON;")
def clean(self) -> None:
with self.lock:
try:
if self.db_path == sqlite_memory:
return
@ -45,5 +46,3 @@ class SqliteDatabase:
except Exception as e:
self._logger.error(f"Error cleaning database: {e}")
raise
finally:
self.lock.release()