Make sure the deferred query will be invoked only once

See https://groups.google.com/forum/#!topic/loopbackjs/Ez1cyQ0D0s0
This commit is contained in:
Raymond Feng 2014-08-25 13:19:47 -07:00
parent 02d974c281
commit 59edab6b12
1 changed files with 1 additions and 1 deletions

View File

@ -129,7 +129,7 @@ require('util').inherits(MySQL, SqlConnector);
MySQL.prototype.query = function (sql, callback) {
var self = this;
if (!this.dataSource.connected) {
return this.dataSource.on('connected', function () {
return this.dataSource.once('connected', function () {
this.query(sql, callback);
}.bind(this));
}