diff --git a/src/main.ts b/src/main.ts index 6384617..02c6380 100644 --- a/src/main.ts +++ b/src/main.ts @@ -145,19 +145,6 @@ async function bootstrap() { `Server running on http://localhost:${process.env.PORT}`, 'Bootstrap', ); - setInterval(async () => await checkEdv(), 120000); -} - -async function checkEdv() { - try { - const resp = await fetch(process.env.EDV_BASE_URL + '/api'); - - if (resp.status == 200) { - process.env.EDV_STATUS = 'UP'; - } - } catch (error) { - process.env.EDV_STATUS = 'DOWN'; - } } bootstrap(); diff --git a/src/mongoose/tenant-mongoose-connections.ts b/src/mongoose/tenant-mongoose-connections.ts index 49e0063..d4b0eb3 100644 --- a/src/mongoose/tenant-mongoose-connections.ts +++ b/src/mongoose/tenant-mongoose-connections.ts @@ -32,7 +32,17 @@ async function tenantConnection(tenantDB, uri) { if (!foundConn) { if (!connectionPromises[tenantDB]) { - connectionPromises[tenantDB] = mongoose.createConnection(uri).asPromise(); + connectionPromises[tenantDB] = mongoose + .createConnection(uri, { + maxConnecting: 10, + maxPoolSize: 100, + maxStalenessSeconds: 100, + maxIdleTimeMS: 500000, + serverSelectionTimeoutMS: 500000, + socketTimeoutMS: 500000, + connectTimeoutMS: 500000, + }) + .asPromise(); } const newConnection = await connectionPromises[tenantDB];