-
Notifications
You must be signed in to change notification settings - Fork 2
fix(PM-2539): added timeout for prisma client #3
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
config/default.js
Outdated
| AUTOMATED_TESTING_NAME_PREFIX: process.env.AUTOMATED_TESTING_NAME_PREFIX || 'POSTMANE2E-', | ||
| TOPCROWD_CHALLENGE_TEMPLATE_ID: process.env.TOPCROWD_CHALLENGE_TEMPLATE_ID || '517e76b0-8824-4e72-9b48-a1ebde1793a8' | ||
| TOPCROWD_CHALLENGE_TEMPLATE_ID: process.env.TOPCROWD_CHALLENGE_TEMPLATE_ID || '517e76b0-8824-4e72-9b48-a1ebde1793a8', | ||
| RESOURCE_SERVICE_PRISMA_TIMEOUT: process.env.RESOURCE_SERVICE_PRISMA_TIMEOUT ? parseInt(process.env.RESOURCE_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]
Consider validating the RESOURCE_SERVICE_PRISMA_TIMEOUT environment variable to ensure it is a positive integer. This can prevent potential runtime errors if the environment variable is set to a non-numeric value or a negative number.
| @@ -1,6 +1,11 @@ | |||
| const { PrismaClient } = require('@prisma/client'); | |||
| const config = require('config') | |||
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]
Ensure that config.MEMBER_SERVICE_PRISMA_TIMEOUT is defined and has a valid value. If it's undefined or set to an invalid value, it could lead to unexpected behavior in timeout settings.
|
|
||
| const prisma = new PrismaClient(); | ||
| const prisma = 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]
Consider verifying that transactionOptions is supported by the version of PrismaClient you are using. If not supported, this could lead to runtime errors.
| USER_CREDENTIALS_PASSWORD: process.env.USER_CREDENTIALS_PASSWORD || '', | ||
| AUTOMATED_TESTING_REPORTERS_FORMAT: process.env.AUTOMATED_TESTING_REPORTERS_FORMAT || ['cli', 'html'] | ||
| AUTOMATED_TESTING_REPORTERS_FORMAT: process.env.AUTOMATED_TESTING_REPORTERS_FORMAT || ['cli', 'html'], | ||
| RESOURCE_SERVICE_PRISMA_TIMEOUT: process.env.RESOURCE_SERVICE_PRISMA_TIMEOUT ? parseInt(process.env.RESOURCE_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]
Consider validating the RESOURCE_SERVICE_PRISMA_TIMEOUT environment variable to ensure it is a positive integer before using parseInt. This will prevent potential issues if the environment variable is set to a non-numeric value or a negative number.
env.sh
Outdated
|
|
||
| export CHALLENGE_DB_URL="postgresql://johndoe:mypassword@localhost:5732/challengedb" | ||
|
|
||
| export RESOURCE_SERVICE_PRISMA_TIMEOU=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]
There is a typo in the environment variable name: RESOURCE_SERVICE_PRISMA_TIMEOU should likely be RESOURCE_SERVICE_PRISMA_TIMEOUT. This could lead to issues if the application expects the correctly spelled variable.
env.sh
Outdated
|
|
||
| export CHALLENGE_DB_URL="postgresql://johndoe:mypassword@localhost:5732/challengedb" | ||
|
|
||
| export RESOURCE_SERVICE_PRISMA_TIMEOU=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.
[💡 style]
Consider adding a newline at the end of the file to adhere to POSIX standards, which can improve compatibility with various tools and editors.
What's in this PR?
Ticket link - https://topcoder.atlassian.net/browse/PM-2539