Skip to content

Commit 005a7e7

Browse files
committed
timeout server selection after 5sec
1 parent 967a7ed commit 005a7e7

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/db/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ const uri = process.env.MONGODB_CONNECTION_STRING;
2020

2121
module.exports = async function connect() {
2222
if (conn == null) {
23-
conn = mongoose.createConnection(uri);
23+
conn = mongoose.createConnection(uri, { serverSelectionTimeoutMS: 5000 });
2424
await conn.asPromise();
2525
}
2626
conn.model('AccessToken', accessTokenSchema, 'AccessToken');

0 commit comments

Comments
 (0)