Skip to content

Commit 6486a94

Browse files
authored
Merge pull request #26 from topcoder-platform/pm-2539
fix(PM-2539): Added timeout to prisma client
2 parents d34e20b + 4a20ab7 commit 6486a94

File tree

4 files changed

+5
-3
lines changed

4 files changed

+5
-3
lines changed

.circleci/config.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ workflows:
103103
- feature/top-262-projectid-non-mandatory
104104
- TOP-2364
105105
- PM-2097
106-
- pm-2456
106+
- pm-2539
107107

108108
- "build-qa":
109109
context: org-global

config/default.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,4 +129,5 @@ module.exports = {
129129
// Database schemas for direct counts (shared DB)
130130
RESOURCES_DB_SCHEMA: process.env.RESOURCES_DB_SCHEMA || "resources",
131131
REVIEW_DB_SCHEMA: process.env.REVIEW_DB_SCHEMA || "reviews",
132+
CHALLENGE_SERVICE_PRISMA_TIMEOUT: process.env.CHALLENGE_SERVICE_PRISMA_TIMEOUT ? parseInt(process.env.CHALLENGE_SERVICE_PRISMA_TIMEOUT, 10) : 10000,
132133
};

src/common/prisma.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ const {
88
ReviewOpportunityTypeEnum,
99
} = require("@prisma/client");
1010
const logger = require("./logger");
11+
const config = require("config");
1112

1213
const prismaClient = new PrismaClient({
1314
log: [
@@ -21,7 +22,7 @@ const prismaClient = new PrismaClient({
2122
// Allow overriding via environment variables if needed.
2223
transactionOptions: {
2324
maxWait: Number(process.env.PRISMA_TRANSACTION_MAX_WAIT_MS || 10000), // wait up to 10s to start
24-
timeout: Number(process.env.PRISMA_TRANSACTION_TIMEOUT_MS || 10000), // allow up to 30s per transaction
25+
timeout: config.CHALLENGE_SERVICE_PRISMA_TIMEOUT, // allow up to 30s per transaction
2526
},
2627
});
2728

src/common/review-prisma.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ const createClient = () =>
1919
],
2020
transactionOptions: {
2121
maxWait: Number(process.env.PRISMA_TRANSACTION_MAX_WAIT_MS || 10000),
22-
timeout: Number(process.env.PRISMA_TRANSACTION_TIMEOUT_MS || 10000),
22+
timeout: config.CHALLENGE_SERVICE_PRISMA_TIMEOUT,
2323
},
2424
});
2525

0 commit comments

Comments
 (0)