mirror of
https://github.com/element-hq/synapse.git
synced 2026-08-16 02:30:26 +00:00
`DatabasePool`'s `inner_func` calls `conn.reconnect()` when a connection is found closed, or to recycle one that has exceeded the per-connection transaction limit (`txn_limit`). The Rust DBAPI2 adapter had no `reconnect`, so those paths (off by default, but real) would have raised. Add `reconnect` to the adapter: it returns the current connection to the pool (or discards it if unusable) and checks out a fresh one. The adapter now holds the pool it was checked out of, with an `owns_pool` flag distinguishing a shared pool (RustConnectionPool — reconnect from it, don't close it) from a bootstrap pool-of-one (`rust_dbapi.connect` — closed together with the connection). Tested: reconnect swaps in a working connection; runWithConnection and the bootstrap/adapter paths are unchanged. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01W3G4M92AmwSSZCbmtMJU3d