-
Couldn't load subscription status.
- Fork 6
fix(PM-2539): Added timeout to prisma client #26
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
| // 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, |
There was a problem hiding this comment.
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.
src/common/prisma.js
Outdated
| const config = require("config"); | ||
|
|
||
| const prismaClient = new PrismaClient({ | ||
| transactionOptions: { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[❗❗ correctness]
The transactionOptions object is defined twice in the PrismaClient constructor. This could lead to unexpected behavior as the second definition will override the first. Consider merging these options into a single transactionOptions object to ensure clarity and prevent potential configuration issues.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@hentrymartin please extend the update also to:
- https://github.com/topcoder-platform/challenge-api-v6/blob/develop/src/common/review-prisma.js
- I couldn't find other but if you find any add it
What's in this PR?
Ticket link - https://topcoder.atlassian.net/browse/PM-2539