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 @@ -64,6 +64,7 @@ workflows:
branches:
only:
- develop
- pm-2539

# Production builds are exectuted only on tagged commits to the
# master branch.
Expand Down
9 changes: 8 additions & 1 deletion src/common/members-lookup.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,14 @@ export class MembersLookupService {
return;
}
// Create a dedicated Prisma client targeting the members DB
this.client = new PrismaClient({ datasources: { db: { url } } });
this.client = new PrismaClient({
transactionOptions: {
timeout: process.env.BA_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 process.env.BA_SERVICE_PRISMA_TIMEOUT before parsing it with parseInt. If the environment variable is not a valid number, parseInt will return NaN, which could lead to unexpected behavior. You might want to add a check to ensure it's a valid integer before using it.

? parseInt(process.env.BA_SERVICE_PRISMA_TIMEOUT, 10)
: 10000,
},
datasources: { db: { url } }
});
this.initialized = true;
}

Expand Down
10 changes: 10 additions & 0 deletions src/common/prisma.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,16 @@ import { PrismaClient } from "@prisma/client";

@Injectable()
export class PrismaService extends PrismaClient implements OnModuleInit {
constructor() {
super({
transactionOptions: {
timeout: process.env.BA_SERVICE_PRISMA_TIMEOUT
? parseInt(process.env.BA_SERVICE_PRISMA_TIMEOUT, 10)

Choose a reason for hiding this comment

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

[❗❗ correctness]
Consider adding a validation check to ensure that process.env.BA_SERVICE_PRISMA_TIMEOUT is a valid number before parsing it. If the environment variable is set to a non-numeric string, parseInt will return NaN, which could lead to unexpected behavior.

: 10000,
},
});
}

async onModuleInit() {
await this.$connect();
}
Expand Down