不要怂,就是干,撸起袖子干!

Commit 34b69bfe by Daniel Durante

Fixed up postgres client + query.run

1 parent bff26805
Showing with 3 additions and 6 deletions
......@@ -37,12 +37,12 @@ module.exports = (function() {
self.pendingQueries += 1
return new Utils.CustomEventEmitter(function(emitter) {
self.connect(function(err) {
self.connect(function(err, client) {
if (!!err) {
return emitter.emit('error', err)
}
var query = new Query(self.client, self.sequelize, callee, options || {})
var query = new Query(client, self.sequelize, callee, options || {})
return query.run(sql)
.success(function() { self.endQuery.call(self) })
......@@ -64,7 +64,6 @@ module.exports = (function() {
ConnectorManager.prototype.connect = function(callback) {
var self = this
var emitter = new (require('events').EventEmitter)()
// in case database is slow to connect, prevent orphaning the client
if (this.isConnecting) {
......@@ -96,7 +95,7 @@ module.exports = (function() {
client.query("SET TIME ZONE 'UTC'").on('end', function() {
self.isConnected = true
self.client = client
callback(null)
callback(null, client)
});
} else {
self.client = null
......@@ -116,8 +115,6 @@ module.exports = (function() {
connectCallback(null, this.client)
}
}
return emitter
}
ConnectorManager.prototype.disconnect = function() {
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!