Repository navigation
Replies: 1 comment 1 reply
|
Have you already looked into the middlewares? https://github.com/gajus/slonik?tab=readme-ov-file#interceptors |
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
I'm looking at how to gracefully handle connections being dropped by the server. For example, PlanetScale Postgres will terminate connections when cutting over from one node to another when upgrading or in a failover scenario. Ideally we'd like to handle this in app by attempting to use another connection in the pool (or having another connection created) to retry the query.
Since we do
import { pool, sql } from "@/lib/database, we could ostensibly wrap thepoolin proxy to handle retries, but it feels a bit brittle and hard to test. Gemini 3 Pro recommended a version of this if it's helpful to see an example (gist).@gajus 🙏
All reactions