Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ workflows:
- feature/top-262-projectid-non-mandatory
- TOP-2364
- PM-2097
- pm-2456
- pm-2539

- "build-qa":
context: org-global
Expand Down
1 change: 1 addition & 0 deletions config/default.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[💡 correctness]
Using parseInt without specifying the radix can lead to unexpected results if the environment variable CHALLENGE_SERVICE_PRISMA_TIMEOUT starts with '0'. It's good practice to always specify the radix, which is correctly done here with 10. Ensure this pattern is consistently applied throughout the codebase.

};
3 changes: 2 additions & 1 deletion src/common/prisma.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ const {
ReviewOpportunityTypeEnum,
} = require("@prisma/client");
const logger = require("./logger");
const config = require("config");

const prismaClient = new PrismaClient({
log: [
Expand All @@ -21,7 +22,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
},
});

Expand Down
2 changes: 1 addition & 1 deletion src/common/review-prisma.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
},
});

Expand Down