From ccf3c8dc66c52659a1fac1f6fd6eec9d6305fa63 Mon Sep 17 00:00:00 2001 From: Clint Haerinck Date: Mon, 10 Feb 2020 11:37:24 +0100 Subject: [PATCH 1/3] Connection state updated after reconnect --- lib/manager.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/manager.js b/lib/manager.js index 8b353dc2..953ef1e1 100644 --- a/lib/manager.js +++ b/lib/manager.js @@ -151,6 +151,9 @@ Manager.prototype.open = function (uri, opts, fn) { self.emit(eventName, e) }) }) + self.on('reconnect', function () { + self._state = STATE.OPEN + }) this.emit('open', this._db) } From 5840171b89867607be758c9ba7294588f53a2039 Mon Sep 17 00:00:00 2001 From: Clint Haerinck Date: Mon, 10 Feb 2020 11:48:42 +0100 Subject: [PATCH 2/3] Function added to reconnect current connection --- lib/manager.js | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/lib/manager.js b/lib/manager.js index 953ef1e1..4cc7b133 100644 --- a/lib/manager.js +++ b/lib/manager.js @@ -255,6 +255,17 @@ Manager.prototype.close = function (force, fn) { } } +/** + * Reconnects the connection. + * + * @return {Promise} + */ + +Manager.prototype.reconnect = function () { + this.open(this._connectionURI, this._connectionOptions) + this._state = STATE.OPENING +} + /** * Lists all collections. * From 4dd9966d16b837a1acc9588b2fc6cb2737ad77cc Mon Sep 17 00:00:00 2001 From: Clint Haerinck Date: Mon, 10 Feb 2020 12:00:20 +0100 Subject: [PATCH 3/3] Documentation wrong No Promise() returned --- lib/manager.js | 2 -- 1 file changed, 2 deletions(-) diff --git a/lib/manager.js b/lib/manager.js index 4cc7b133..0a33fde6 100644 --- a/lib/manager.js +++ b/lib/manager.js @@ -257,8 +257,6 @@ Manager.prototype.close = function (force, fn) { /** * Reconnects the connection. - * - * @return {Promise} */ Manager.prototype.reconnect = function () {