Irakli Safareli
11/24/2021, 4:17 PMRequest#1 prisma query ...
Request#2 prisma query ...
Request#1 prisma query ...
Request#2 prisma query ...
...
Is there something that one can do to active this?
of course naive approach would be to create multiple prisma clients per request. but if you have 100 requsts and each client creates multiple db connection it’s not good.
basically some “soft clone” like function is needed on prisma client
const softClone = (c: PrismaClient, context: unknown): PrismaClient
and then in when listening to events on prisma:
prisma.$on("query", (e) => {
console.log(e.context, "query", e.query);
});
and this softClone should not result in new connections (should use previous prisma client.
Any suggestions? is there issue for it?
(I’ve created an issue here: https://github.com/prisma/prisma/issues/10425)Ryan
11/25/2021, 5:30 AM