Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 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
1 change: 1 addition & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ workflows:
- feat/ai-workflows
- pm-1955_2
- re-try-failed-jobs
- pm-2539


- 'build-prod':
Expand Down
2 changes: 2 additions & 0 deletions .env.sample
Original file line number Diff line number Diff line change
Expand Up @@ -73,3 +73,5 @@ SENDGRID_ACCEPT_REVIEW_APPLICATION="d-2de72880bd69499e9c16369398d34bb9"
SENDGRID_REJECT_REVIEW_APPLICATION="d-82ed74e778e84d8c9bc02eeda0f44b5e"
# For pulling payment details (used by platform-ui)
FINANCE_DB_URL=
#Prisma timeout
REVIEW_SERVICE_PRISMA_TIMEOUT=10000
5 changes: 5 additions & 0 deletions src/shared/modules/global/challenge-prisma.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,11 @@ export class ChallengePrismaService

constructor() {
super({
transactionOptions: {
timeout: process.env.REVIEW_SERVICE_PRISMA_TIMEOUT
? parseInt(process.env.REVIEW_SERVICE_PRISMA_TIMEOUT, 10)
: 10000,
},
log: [
{ level: 'query', emit: 'event' },
{ level: 'info', emit: 'event' },
Expand Down
5 changes: 5 additions & 0 deletions src/shared/modules/global/member-prisma.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,11 @@ export class MemberPrismaService

constructor() {
super({
transactionOptions: {
timeout: process.env.REVIEW_SERVICE_PRISMA_TIMEOUT

Choose a reason for hiding this comment

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

[❗❗ correctness]
Consider validating the environment variable REVIEW_SERVICE_PRISMA_TIMEOUT before parsing it. If it contains non-numeric values, parseInt will return NaN, which could lead to unexpected behavior. You might want to add a check to ensure it's a valid number.

? parseInt(process.env.REVIEW_SERVICE_PRISMA_TIMEOUT, 10)
: 10000,
},
log: [
{ level: 'query', emit: 'event' },
{ level: 'info', emit: 'event' },
Expand Down
5 changes: 5 additions & 0 deletions src/shared/modules/global/prisma.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,11 @@ export class PrismaService
const schema = process.env.POSTGRES_SCHEMA || 'public';

super({
transactionOptions: {
timeout: process.env.REVIEW_SERVICE_PRISMA_TIMEOUT

Choose a reason for hiding this comment

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

[⚠️ correctness]
Consider validating the environment variable REVIEW_SERVICE_PRISMA_TIMEOUT to ensure it is a valid integer before parsing. This can prevent potential runtime errors if the environment variable is set to a non-numeric value.

? parseInt(process.env.REVIEW_SERVICE_PRISMA_TIMEOUT, 10)
: 10000,
},
log: [
{ level: 'query', emit: 'event' },
{ level: 'info', emit: 'event' },
Expand Down
5 changes: 5 additions & 0 deletions src/shared/modules/global/resource-prisma.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,11 @@ export class ResourcePrismaService

constructor() {
super({
transactionOptions: {
timeout: process.env.REVIEW_SERVICE_PRISMA_TIMEOUT

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 contains a non-decimal number. Although the radix is specified here, ensure that the environment variable is always a valid integer to avoid potential issues.

Choose a reason for hiding this comment

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

[⚠️ security]
Consider validating the environment variable REVIEW_SERVICE_PRISMA_TIMEOUT to ensure it is a positive integer. This will prevent potential misconfigurations from causing unexpected behavior.

? parseInt(process.env.REVIEW_SERVICE_PRISMA_TIMEOUT, 10)
: 10000,
},
log: [
{ level: 'query', emit: 'event' },
{ level: 'info', emit: 'event' },
Expand Down