From 2dc076495058cd9fac2ef4ac3d1be5407ff9b9cd Mon Sep 17 00:00:00 2001 From: Justin Langston Date: Tue, 26 Sep 2017 20:54:36 -0400 Subject: [PATCH] stop db service if/when closed --- lib/services/db/index.js | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/lib/services/db/index.js b/lib/services/db/index.js index 2a6e00fb..f44c6276 100644 --- a/lib/services/db/index.js +++ b/lib/services/db/index.js @@ -183,15 +183,10 @@ DB.prototype.stop = function(callback) { }; DB.prototype.close = function(callback) { - - var self = this; - if (self._store && self._store.isOpen()) { - // give the db a grace period to settle out - return setTimeout(function() { - self._store.close(callback); - }, 2000); + if(!this._store || this._store.isClosed()){ + return callback(); } - setImmediate(callback); + this._store.close(callback); }; DB.prototype.getAPIMethods = function() {