2matto
Explore posts from serversWhere to put clean up code?
I have a DB connection setup in my
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
https://discord.com/channels/867764511159091230/1049691729516843048/1049691729516843048)7 replies