Safe connect call
This commit is contained in:
parent
23004c12c1
commit
8370538e4e
|
@ -122,6 +122,7 @@ function Schema(name, settings) {
|
|||
schema.connect = function(cb) {
|
||||
var schema = this;
|
||||
schema.connecting = true;
|
||||
if (schema.adapter.connect) {
|
||||
schema.adapter.connect(function(err) {
|
||||
if (!err) {
|
||||
schema.connected = true;
|
||||
|
@ -132,6 +133,9 @@ function Schema(name, settings) {
|
|||
cb(err);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
process.nextTick(cb);
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in New Issue