Files
FabledScribe/src/fabledassistant/models
bvandeusen f055b361aa Add pool_pre_ping and pool_recycle to SQLAlchemy engine
Without pool_pre_ping, stale pooled connections (left over after a Postgres
restart or network blip) cause immediate query failures. SQLAlchemy then
propagates the error rather than transparently reconnecting, which crashes
the Quart request handler and triggers a Swarm restart loop.

- pool_pre_ping=True: issues a lightweight SELECT 1 before each checkout;
  discards and replaces stale connections silently
- pool_recycle=1800: recycles connections every 30 minutes to prevent
  long-idle connections from going stale at the TCP/firewall level

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-02-24 18:39:53 -05:00
..