From 0859b01c1209fb491441ef3d820dec9c07b31c95 Mon Sep 17 00:00:00 2001 From: Lei PAN Date: Tue, 12 Mar 2024 08:42:53 +0100 Subject: [PATCH] set timeout to 30s for mongodb --- src/models/DeviceExcludeMode.js | 1 + src/workers/mongo_manager.js | 6 ++++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/models/DeviceExcludeMode.js b/src/models/DeviceExcludeMode.js index f00c6f4..781c5a9 100644 --- a/src/models/DeviceExcludeMode.js +++ b/src/models/DeviceExcludeMode.js @@ -1,4 +1,5 @@ const DeviceExcludeMode = { + ZERO: Symbol("ZERO"), NINE: Symbol("NINE"), THREE: Symbol("THREE"), SIX: Symbol("SIX"), diff --git a/src/workers/mongo_manager.js b/src/workers/mongo_manager.js index 67343d6..4e91a2a 100644 --- a/src/workers/mongo_manager.js +++ b/src/workers/mongo_manager.js @@ -24,12 +24,14 @@ function formatDate(date) { return [year, month, day].join('-'); } - +const config = { + connectTimeoutMS: 30000 +} class MongoManager { constructor() { //init mongoDb let uri = `mongodb://appointment:Rdv%402022@${MONGO_DB_URL}/appointment` - this.client = new MongoClient(uri) + this.client = new MongoClient(uri, config) } async connect() {