Skip to content

Commit 904b25a

Browse files
committed
fix: added timeout for prisma client
1 parent e880c4e commit 904b25a

File tree

3 files changed

+19
-1
lines changed

3 files changed

+19
-1
lines changed

.circleci/config.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ workflows:
6464
branches:
6565
only:
6666
- develop
67+
- pm-2539
6768

6869
# Production builds are exectuted only on tagged commits to the
6970
# master branch.

src/common/members-lookup.service.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,14 @@ export class MembersLookupService {
2020
return;
2121
}
2222
// Create a dedicated Prisma client targeting the members DB
23-
this.client = new PrismaClient({ datasources: { db: { url } } });
23+
this.client = new PrismaClient({
24+
transactionOptions: {
25+
timeout: process.env.BA_SERVICE_PRISMA_TIMEOUT
26+
? parseInt(process.env.BA_SERVICE_PRISMA_TIMEOUT, 10)
27+
: 10000,
28+
},
29+
datasources: { db: { url } }
30+
});
2431
this.initialized = true;
2532
}
2633

src/common/prisma.service.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,16 @@ import { PrismaClient } from "@prisma/client";
33

44
@Injectable()
55
export class PrismaService extends PrismaClient implements OnModuleInit {
6+
constructor() {
7+
super({
8+
transactionOptions: {
9+
timeout: process.env.BA_SERVICE_PRISMA_TIMEOUT
10+
? parseInt(process.env.BA_SERVICE_PRISMA_TIMEOUT, 10)
11+
: 10000,
12+
},
13+
});
14+
}
15+
616
async onModuleInit() {
717
await this.$connect();
818
}

0 commit comments

Comments
 (0)