Merge pull request #523 from nitsujlangston/gentlerDbClose
wait for db to gracefully close before stopping db service
This commit is contained in:
commit
2a1af1e93f
@ -183,15 +183,10 @@ DB.prototype.stop = function(callback) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
DB.prototype.close = function(callback) {
|
DB.prototype.close = function(callback) {
|
||||||
|
if(!this._store || this._store.isClosed()){
|
||||||
var self = this;
|
return callback();
|
||||||
if (self._store && self._store.isOpen()) {
|
|
||||||
// give the db a grace period to settle out
|
|
||||||
return setTimeout(function() {
|
|
||||||
self._store.close(callback);
|
|
||||||
}, 2000);
|
|
||||||
}
|
}
|
||||||
setImmediate(callback);
|
this._store.close(callback);
|
||||||
};
|
};
|
||||||
|
|
||||||
DB.prototype.getAPIMethods = function() {
|
DB.prototype.getAPIMethods = function() {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user