mirror of
https://github.com/pewdiepie-archdaemon/odysseus.git
synced 2026-06-16 01:35:36 -04:00
e384c5a2a6
The _migrate_* startup helpers in core/database.py opened a raw sqlite3.connect() inside a try and called conn.close() as the last statement in that try. If any earlier statement raised (locked DB, unexpected schema, a failed ALTER), close() was skipped and the bare except only logged the error — leaking the connection (file handle + lock) for the lifetime of the process. These migrations run on every startup. Wrap each in the conn = None + try/except/finally pattern already used by _migrate_chat_messages_fts in this same file, so the connection is closed on all exit paths. 25 functions; no change on the success path. Helpers that already close safely are left untouched: _migrate_chat_messages_fts and _migrate_backfill_task_folders (the latter uses SQLAlchemy's engine.connect() context manager). Same bug class as the previously merged DB-connection-leak fix (#64) and the IMAP logout-on-all-paths fix (#1530).