From 904b25aa369e12c2d3aa422222dd17eeb3a7e12a Mon Sep 17 00:00:00 2001 From: Hentry Martin Date: Mon, 27 Oct 2025 16:13:27 +0100 Subject: [PATCH] fix: added timeout for prisma client --- .circleci/config.yml | 1 + src/common/members-lookup.service.ts | 9 ++++++++- src/common/prisma.service.ts | 10 ++++++++++ 3 files changed, 19 insertions(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 2d3ac26..79d39d6 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -64,6 +64,7 @@ workflows: branches: only: - develop + - pm-2539 # Production builds are exectuted only on tagged commits to the # master branch. diff --git a/src/common/members-lookup.service.ts b/src/common/members-lookup.service.ts index 66e2748..0432154 100644 --- a/src/common/members-lookup.service.ts +++ b/src/common/members-lookup.service.ts @@ -20,7 +20,14 @@ export class MembersLookupService { return; } // Create a dedicated Prisma client targeting the members DB - this.client = new PrismaClient({ datasources: { db: { url } } }); + this.client = new PrismaClient({ + transactionOptions: { + timeout: process.env.BA_SERVICE_PRISMA_TIMEOUT + ? parseInt(process.env.BA_SERVICE_PRISMA_TIMEOUT, 10) + : 10000, + }, + datasources: { db: { url } } + }); this.initialized = true; } diff --git a/src/common/prisma.service.ts b/src/common/prisma.service.ts index 952711f..2e4f63a 100644 --- a/src/common/prisma.service.ts +++ b/src/common/prisma.service.ts @@ -3,6 +3,16 @@ import { PrismaClient } from "@prisma/client"; @Injectable() export class PrismaService extends PrismaClient implements OnModuleInit { + constructor() { + super({ + transactionOptions: { + timeout: process.env.BA_SERVICE_PRISMA_TIMEOUT + ? parseInt(process.env.BA_SERVICE_PRISMA_TIMEOUT, 10) + : 10000, + }, + }); + } + async onModuleInit() { await this.$connect(); }