Skip to content

Conversation

@hentrymartin
Copy link
Collaborator

What's in this PR?

  • Added timeout to prisma client

Ticket link - https://topcoder.atlassian.net/browse/PM-2539

// 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.

const config = require("config");

const prismaClient = new PrismaClient({
transactionOptions: {

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.

Copy link
Contributor

@kkartunov kkartunov left a 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:

@kkartunov kkartunov merged commit 6486a94 into develop Oct 29, 2025
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants