Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Merge pull request #270 from raymondfeng/master

Fix connect() related issues
  • Loading branch information...
commit 9a7d3f1043b13baad392c38b485548dbcd386a7f 2 parents 24329c3 + ad1b2ad
@1602 authored
Showing with 4 additions and 5 deletions.
  1. +3 −4 lib/model.js
  2. +1 −1  lib/schema.js
View
7 lib/model.js
@@ -260,13 +260,12 @@ AbstractClass.create = function (data, callback) {
function stillConnecting(schema, obj, args) {
if (schema.connected) return false;
- if (!schema.connecting) {
- schema.connect();
- }
+ if (schema.connecting) return true;
var method = args.callee;
- schema.on('connected', function () {
+ schema.once('connected', function () {
method.apply(obj, [].slice.call(args));
});
+ schema.connect();
return true;
};
View
2  lib/schema.js
@@ -67,7 +67,7 @@ function Schema(name, settings) {
// Disconnected by default
this.connected = false;
- this.connecting = true;
+ this.connecting = false;
// create blank models pool
this.models = {};
Please sign in to comment.
Something went wrong with that request. Please try again.