Skip to content

Keep in-memory SQLite pool connection alive across recycling#290

Merged
daniel-thom merged 1 commit intomainfrom
fix/in-memory-db
Apr 28, 2026
Merged

Keep in-memory SQLite pool connection alive across recycling#290
daniel-thom merged 1 commit intomainfrom
fix/in-memory-db

Conversation

@daniel-thom
Copy link
Copy Markdown
Collaborator

Shared-cache :memory: databases are destroyed the moment the connection count hits zero. min_connections(1) only targets a floor; sqlx's reaper closes a connection before opening its replacement when idle_timeout or max_lifetime fires, and that brief gap is enough to wipe the database. Disable both timers in in-memory mode so the bootstrap connection lives for the process lifetime.

Shared-cache `:memory:` databases are destroyed the moment the
connection count hits zero. `min_connections(1)` only targets a floor;
sqlx's reaper closes a connection before opening its replacement when
`idle_timeout` or `max_lifetime` fires, and that brief gap is enough to
wipe the database. Disable both timers in in-memory mode so the
bootstrap connection lives for the process lifetime.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@daniel-thom daniel-thom requested a review from Copilot April 28, 2026 16:27
@daniel-thom daniel-thom merged commit 4c6d2df into main Apr 28, 2026
4 checks passed
@daniel-thom daniel-thom deleted the fix/in-memory-db branch April 28, 2026 18:48
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