Skip to content

Commit 7f261df

Browse files
committed
update connection settings
1 parent 5b806d8 commit 7f261df

File tree

2 files changed

+11
-14
lines changed

2 files changed

+11
-14
lines changed

Diff for: src/main.ts

-13
Original file line numberDiff line numberDiff line change
@@ -145,19 +145,6 @@ async function bootstrap() {
145145
`Server running on http://localhost:${process.env.PORT}`,
146146
'Bootstrap',
147147
);
148-
setInterval(async () => await checkEdv(), 120000);
149-
}
150-
151-
async function checkEdv() {
152-
try {
153-
const resp = await fetch(process.env.EDV_BASE_URL + '/api');
154-
155-
if (resp.status == 200) {
156-
process.env.EDV_STATUS = 'UP';
157-
}
158-
} catch (error) {
159-
process.env.EDV_STATUS = 'DOWN';
160-
}
161148
}
162149

163150
bootstrap();

Diff for: src/mongoose/tenant-mongoose-connections.ts

+11-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,17 @@ async function tenantConnection(tenantDB, uri) {
3232

3333
if (!foundConn) {
3434
if (!connectionPromises[tenantDB]) {
35-
connectionPromises[tenantDB] = mongoose.createConnection(uri).asPromise();
35+
connectionPromises[tenantDB] = mongoose
36+
.createConnection(uri, {
37+
maxConnecting: 10,
38+
maxPoolSize: 100,
39+
maxStalenessSeconds: 100,
40+
maxIdleTimeMS: 500000,
41+
serverSelectionTimeoutMS: 500000,
42+
socketTimeoutMS: 500000,
43+
connectTimeoutMS: 500000,
44+
})
45+
.asPromise();
3646
}
3747

3848
const newConnection = await connectionPromises[tenantDB];

0 commit comments

Comments
 (0)