mirror of
https://github.com/element-hq/synapse.git
synced 2026-11-13 01:08:41 +00:00
`adbapi.ConnectionPool` obtains connections via a `connectionFactory` attribute, which the database-outage tests swap out to make every checkout fail (and restore afterwards). `RustConnectionPool` checked out connections inline, so it had no such hook and the outage tests errored with `AttributeError`. Give it a `connectionFactory` attribute (defaulting to a checkout from the native pool, wrapped in the DBAPI2 adapter) and route both `runWithConnection` and `connect` through it, so a test's replacement takes effect. Also make the native pool reopenable: `close` drops it and `start` opens a fresh one, so the tests' `close()`/`start()` outage cycle recovers rather than leaving the pool permanently shut. Fixes the tests.storage.databases.main.test_events_worker DatabaseOutage failures on the Rust backend (12/12 pass); psycopg2 and sqlite are unaffected. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01W3G4M92AmwSSZCbmtMJU3d