From 362af3fed1363153a4d14901b7fc25136440bf3c Mon Sep 17 00:00:00 2001 From: Hentry Martin Date: Mon, 27 Oct 2025 12:58:00 +0100 Subject: [PATCH 1/4] fix: added timeout for prisma client --- config/default.js | 1 + src/common/prisma.js | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/config/default.js b/config/default.js index b270dd8..ef8a2ef 100644 --- a/config/default.js +++ b/config/default.js @@ -129,4 +129,5 @@ module.exports = { // Database schemas for direct counts (shared DB) RESOURCES_DB_SCHEMA: process.env.RESOURCES_DB_SCHEMA || "resources", REVIEW_DB_SCHEMA: process.env.REVIEW_DB_SCHEMA || "reviews", + CHALLENGE_SERVICE_PRISMA_TIMEOUT: process.env.CHALLENGE_SERVICE_PRISMA_TIMEOUT ? parseInt(process.env.CHALLENGE_SERVICE_PRISMA_TIMEOUT, 10) : 10000, }; diff --git a/src/common/prisma.js b/src/common/prisma.js index 69bdb54..19b05de 100644 --- a/src/common/prisma.js +++ b/src/common/prisma.js @@ -8,8 +8,12 @@ const { ReviewOpportunityTypeEnum, } = require("@prisma/client"); const logger = require("./logger"); +const config = require("config"); const prismaClient = new PrismaClient({ + transactionOptions: { + timeout: config.CHALLENGE_SERVICE_PRISMA_TIMEOUT, + }, log: [ { level: "query", emit: "event" }, { level: "info", emit: "event" }, From 21e760d25e41fac8f44b77279af45aa256034b4c Mon Sep 17 00:00:00 2001 From: Hentry Martin Date: Mon, 27 Oct 2025 12:58:18 +0100 Subject: [PATCH 2/4] fix: added timeout for prisma client --- .circleci/config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 64c0915..5477ddb 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -103,7 +103,7 @@ workflows: - feature/top-262-projectid-non-mandatory - TOP-2364 - PM-2097 - - pm-2456 + - pm-2539 - "build-qa": context: org-global From fd82edf47654ea757ed2922808da1eb46066b25c Mon Sep 17 00:00:00 2001 From: Hentry Martin Date: Tue, 28 Oct 2025 18:35:27 +0100 Subject: [PATCH 3/4] fix: used CHALLENGE_SERVICE_PRISMA_TIMEOUT instead of PRISMA_TRANSACTION_TIMEOUT_MS --- src/common/prisma.js | 2 +- src/common/review-prisma.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/common/prisma.js b/src/common/prisma.js index 19b05de..1f49d85 100644 --- a/src/common/prisma.js +++ b/src/common/prisma.js @@ -25,7 +25,7 @@ const prismaClient = new PrismaClient({ // Allow overriding via environment variables if needed. transactionOptions: { maxWait: Number(process.env.PRISMA_TRANSACTION_MAX_WAIT_MS || 10000), // wait up to 10s to start - timeout: Number(process.env.PRISMA_TRANSACTION_TIMEOUT_MS || 10000), // allow up to 30s per transaction + timeout: config.CHALLENGE_SERVICE_PRISMA_TIMEOUT, // allow up to 30s per transaction }, }); diff --git a/src/common/review-prisma.js b/src/common/review-prisma.js index efa9df1..12d0a36 100644 --- a/src/common/review-prisma.js +++ b/src/common/review-prisma.js @@ -19,7 +19,7 @@ const createClient = () => ], transactionOptions: { maxWait: Number(process.env.PRISMA_TRANSACTION_MAX_WAIT_MS || 10000), - timeout: Number(process.env.PRISMA_TRANSACTION_TIMEOUT_MS || 10000), + timeout: config.CHALLENGE_SERVICE_PRISMA_TIMEOUT, }, }); From 4a20ab7d32e33499911844b58c9ee8da727f98b0 Mon Sep 17 00:00:00 2001 From: Hentry Martin Date: Tue, 28 Oct 2025 20:36:48 +0100 Subject: [PATCH 4/4] fix: lint --- src/common/prisma.js | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/common/prisma.js b/src/common/prisma.js index 1f49d85..7d302ea 100644 --- a/src/common/prisma.js +++ b/src/common/prisma.js @@ -11,9 +11,6 @@ const logger = require("./logger"); const config = require("config"); const prismaClient = new PrismaClient({ - transactionOptions: { - timeout: config.CHALLENGE_SERVICE_PRISMA_TIMEOUT, - }, log: [ { level: "query", emit: "event" }, { level: "info", emit: "event" },