set timeout to 30s for mongodb

This commit is contained in:
Lei PAN
2024-03-12 08:42:53 +01:00
parent 25ce0eec2d
commit 0859b01c12
2 changed files with 5 additions and 2 deletions
+1
View File
@@ -1,4 +1,5 @@
const DeviceExcludeMode = { const DeviceExcludeMode = {
ZERO: Symbol("ZERO"),
NINE: Symbol("NINE"), NINE: Symbol("NINE"),
THREE: Symbol("THREE"), THREE: Symbol("THREE"),
SIX: Symbol("SIX"), SIX: Symbol("SIX"),
+4 -2
View File
@@ -24,12 +24,14 @@ function formatDate(date) {
return [year, month, day].join('-'); return [year, month, day].join('-');
} }
const config = {
connectTimeoutMS: 30000
}
class MongoManager { class MongoManager {
constructor() { constructor() {
//init mongoDb //init mongoDb
let uri = `mongodb://appointment:Rdv%402022@${MONGO_DB_URL}/appointment` let uri = `mongodb://appointment:Rdv%402022@${MONGO_DB_URL}/appointment`
this.client = new MongoClient(uri) this.client = new MongoClient(uri, config)
} }
async connect() { async connect() {