fix: remove db.close() from handle_db_errors error handler (#38) #42

Open
cal wants to merge 2 commits from ai/major-domo-database-38 into next-release

2 Commits

Author SHA1 Message Date
Cal Corum
55bf035db0 fix: restore finally block in handle_db_errors to prevent connection leaks (#38)
Reviewer correctly identified that removing the finally block introduced
real connection leaks for handlers that do not call db.close() on their
own error paths. Peewee's PooledDatabase.close() is a no-op on the second
call, so double-close is harmless — the finally block provides necessary
safety net.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-07 02:01:48 -06:00
Cal Corum
7734e558a9 fix: remove db.close() from handle_db_errors error handler (#38)
All checks were successful
Build Docker Image / build (pull_request) Successful in 1m59s
Removes the `finally` block that called `db.close()` after rollback in
the `handle_db_errors` decorator. With connection pooling, route handlers
already call `db.close()` themselves, so closing again in the error handler
could return connections to the pool twice, corrupting pool state.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-05 10:02:45 -06:00