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
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
2 changes: 2 additions & 0 deletions src/shared/modules/global/challenge-prisma.service.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { Injectable, OnModuleDestroy, OnModuleInit } from '@nestjs/common';
import { PrismaClient, Prisma } from '@prisma/client';
import { LoggerService } from './logger.service';
import { Utils } from './utils.service';

@Injectable()
export class ChallengePrismaService
Expand All @@ -11,6 +12,7 @@ export class ChallengePrismaService

constructor() {
super({
...Utils.getPrismaTimeout(),

Choose a reason for hiding this comment

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

[❗❗ correctness]
The change replaces direct environment variable parsing with a utility function Utils.getPrismaTimeout(). Ensure that this utility function handles errors or edge cases, such as missing environment variables or invalid values, to prevent potential runtime issues.

log: [
{ level: 'query', emit: 'event' },
{ level: 'info', emit: 'event' },
Expand Down
2 changes: 2 additions & 0 deletions src/shared/modules/global/member-prisma.service.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { Injectable, OnModuleDestroy, OnModuleInit } from '@nestjs/common';
import { PrismaClient, Prisma } from '@prisma/client-member';
import { LoggerService } from './logger.service';
import { Utils } from './utils.service';

@Injectable()
export class MemberPrismaService
Expand All @@ -11,6 +12,7 @@ export class MemberPrismaService

constructor() {
super({
...Utils.getPrismaTimeout(),

Choose a reason for hiding this comment

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

[⚠️ correctness]
The Utils.getPrismaTimeout() function should be reviewed to ensure it handles environment variables and defaults correctly, similar to the previous implementation. Ensure it provides a clear error or fallback if the environment variable is not set or is invalid.

log: [
{ level: 'query', emit: 'event' },
{ level: 'info', emit: 'event' },
Expand Down
2 changes: 2 additions & 0 deletions src/shared/modules/global/prisma.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { PrismaClient, Prisma } from '@prisma/client';
import { LoggerService } from './logger.service';
import { PrismaErrorService } from './prisma-error.service';
import { getStore } from 'src/shared/request/requestStore';
import { Utils } from './utils.service';

Choose a reason for hiding this comment

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

[❗❗ correctness]
Ensure that Utils.getPrismaTimeout() is correctly handling environment variables and defaults. If getPrismaTimeout() is not properly defined, it could lead to unexpected behavior or errors.


enum auditField {
createdBy = 'createdBy',
Expand Down Expand Up @@ -197,6 +198,7 @@ export class PrismaService
const schema = process.env.POSTGRES_SCHEMA || 'public';

super({
...Utils.getPrismaTimeout(),
log: [
{ level: 'query', emit: 'event' },
{ level: 'info', emit: 'event' },
Expand Down
2 changes: 2 additions & 0 deletions src/shared/modules/global/resource-prisma.service.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { Injectable, OnModuleDestroy, OnModuleInit } from '@nestjs/common';
import { PrismaClient, Prisma } from '@prisma/client-resource';
import { LoggerService } from './logger.service';
import { Utils } from './utils.service';

@Injectable()
export class ResourcePrismaService
Expand All @@ -11,6 +12,7 @@ export class ResourcePrismaService

constructor() {
super({
...Utils.getPrismaTimeout(),

Choose a reason for hiding this comment

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

[❗❗ correctness]
The Utils.getPrismaTimeout() function is used here, but it's unclear if it handles the case where process.env.REVIEW_SERVICE_PRISMA_TIMEOUT is not set. Ensure that this function provides a default timeout value to prevent potential runtime errors.

log: [
{ level: 'query', emit: 'event' },
{ level: 'info', emit: 'event' },
Expand Down
10 changes: 10 additions & 0 deletions src/shared/modules/global/utils.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,14 @@ export class Utils {
static bigIntToNumber(t) {
return t ? Number(t) : null;
}

static getPrismaTimeout() {
return {
transactionOptions: {
timeout: process.env.REVIEW_SERVICE_PRISMA_TIMEOUT
? parseInt(process.env.REVIEW_SERVICE_PRISMA_TIMEOUT, 10)
: 10000,
},
};
}
}