Skip to content

Fix/close database connections - #13

Merged
PaJson merged 2 commits into
mainfrom
fix/close-database-connections
Oct 25, 2026
Merged

PaJson merged 2 commits into
mainfrom
fix/close-database-connections

Conversation

@PaJson

@PaJson PaJson commented Oct 25, 2026

Copy link
Copy Markdown
Owner

No description provided.

PaJson and others added 2 commits October 25, 2026 23:04
…e daemon loop

- `with open_database() as connection` commits but never closes a sqlite3 connection, so 8 call sites (main.py, cli_commands.py, queue_reports.py) left it to the garbage collector; Python 3.13+ reports that as a ResourceWarning, and an open handle can block deleting state.db on Windows
- they now use `with closing(open_database()) as connection, connection:` (commit or roll back, then close), the pattern the other 34 call sites already use
- the test fakes of `open_database` return a mock connection instead of a bare context manager; two unclosed files in tests are closed too

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@PaJson
PaJson merged commit e050ff9 into main Oct 25, 2026
7 checks passed
@PaJson
PaJson deleted the fix/close-database-connections branch October 25, 2026 22:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant