Where to put clean up code?
I have a DB connection setup in my
But I cannot find any good spots in the TRPC lifecycle to make that call.
I tried just running it in a middleware, but seemingly that is invoked on each query in a batch independently, whereas I need it to be called once all queries have finished.
FWIW: I am using create-t3-app with @vercel/postgres and
Any insight would be appreciated!
(There is a similar post from a few years ago that went unanswered, though it was fastify-specific
Recommended way to close context db connections (fastify))
createContext that I must explicitly close per-request.But I cannot find any good spots in the TRPC lifecycle to make that call.
I tried just running it in a middleware, but seemingly that is invoked on each query in a batch independently, whereas I need it to be called once all queries have finished.
FWIW: I am using create-t3-app with @vercel/postgres and
createClient.Any insight would be appreciated!
(There is a similar post from a few years ago that went unanswered, though it was fastify-specific
Recommended way to close context db connections (fastify))
Discord
Discord is the easiest way to communicate over voice, video, and text. Chat, hang out, and stay close with your friends and communities.