Fix credential_db schema conflict and add resilience
credential_sniffer and credential_db both wrote to the same credentials.db with different schemas; credential_db's executescript failed when creating the crack_status index on an existing table that lacked that column. Fix: split credential_db's schema init into table DDL + migration + indexes so missing columns are added before index creation runs. Migration also handles any future schema drift. state.py: add 30s timeout + busy_timeout PRAGMA to write connection so concurrent subprocess writes stop failing with 'database is locked'. capture_bus.py: reconnect on ENETDOWN instead of aborting the capture loop — mac_manager temporarily brings the interface down during MAC rotation which was silently killing all packet capture.
This commit is contained in:
+2
-1
@@ -139,9 +139,10 @@ class StateManager:
|
||||
|
||||
def _get_write_conn(self) -> sqlite3.Connection:
|
||||
if self._write_conn is None:
|
||||
self._write_conn = sqlite3.connect(self._db_path, check_same_thread=False)
|
||||
self._write_conn = sqlite3.connect(self._db_path, check_same_thread=False, timeout=30)
|
||||
self._write_conn.execute("PRAGMA journal_mode=WAL")
|
||||
self._write_conn.execute("PRAGMA synchronous=NORMAL")
|
||||
self._write_conn.execute("PRAGMA busy_timeout=30000")
|
||||
return self._write_conn
|
||||
|
||||
# ------------------------------------------------------------------
|
||||
|
||||
Reference in New Issue
Block a user