Skip to content

Commit

Permalink
update connection settings
Browse files Browse the repository at this point in the history
  • Loading branch information
Pratap2018 committed Nov 25, 2024
1 parent 02d48cf commit 6f523c4
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/user-vault/providers/databaseProviders.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,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];
Expand Down

0 comments on commit 6f523c4

Please sign in to comment.