why does prisma never read from main db and always from replicas?

we're barely seeing any traffic on our main db, but both replicas have 80% cpu utilization. why is the load not getting spread? I just reset both replicas at the same itme and for some reason the entire website went down, which sshouldn't happen if prisma were reading from main ```import { PrismaClient } from '@prisma/client'; import { readReplicas } from '@prisma/extension-read-replicas'; declare const global: Global & { prisma?: ReturnType<typeof createPrismaClient>; }; export let prisma: ReturnType<typeof createPrismaClient>; function createPrismaClient() { return new PrismaClient().$extends( readReplicas({ url: [ process.env.DB_REPLICA_URL_1 ?? '', process.env.DB_REPLICA_URL_2 ?? '', ], }), ); } if (typeof window === 'undefined') { if (process.env['NODE_ENV'] === 'production') { prisma = createPrismaClient(); } else { if (!global.prisma) { global.prisma = createPrismaClient(); } prisma = global.prisma; } }
1 Reply
sylvester stallone
sylvester stalloneOP5mo ago
@Nurul (Prisma) @Ankur Datta
Want results from more Discord servers?
Add your server