stop db service if/when closed

This commit is contained in:
Justin Langston 2017-09-26 20:54:36 -04:00
parent 3c4aff4027
commit 2dc0764950
No known key found for this signature in database
GPG Key ID: EBB3714C72F9FE5D

View File

@ -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() {