mshumayl / ai-daleel

AI Daleel source code.
https://ai-daleel.vercel.app
1 stars 0 forks source link

Close Prisma Client in each tRPC endpoint #18

Closed mshumayl closed 1 year ago

mshumayl commented 1 year ago

None of the Prisma Clients are closed automatically. This needs to be handled manually in the tRPC endpoints.

warn(prisma-client) There are already 10 instances of Prisma Client actively running.
warn(prisma-client) There are already 10 instances of Prisma Client actively running.
mshumayl commented 1 year ago

Update: The correct solution is to use a global Prisma client.

This has been implemented by create-t3-app in src\server\api\routers\db.ts.

So the remaining thing to do is:

  1. In the router file, change import { PrismaClient } from '@prisma/client' to import { prisma } from '../../db'.
  2. Remove any new instantiations of the Prisma client.
  3. Test endpoints.