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

You need to sign in or sign up before continuing.
Commit 059bab9e by Daniel Durante

Fixed up one off connection clients for Sequelize (if client is already defined …

…simply callback rather than connecting again).
1 parent a8ca68f9
Showing with 11 additions and 7 deletions
......@@ -106,10 +106,10 @@ module.exports = (function() {
}
} else if (client) {
client.query("SET TIME ZONE 'UTC'").on('end', function() {
self.isConnected = true
self.client = client
emitter.emit('success', done)
})
self.isConnected = true
self.client = client
emitter.emit('success', done)
})
} else {
self.client = null
emitter.emit('success', done)
......@@ -121,9 +121,13 @@ module.exports = (function() {
this.poolIdentifier = this.pg.pools.getOrCreate(this.sequelize.config)
this.poolIdentifier.connect(connectCallback)
} else {
//create one-off client
this.client = new this.pg.Client(uri)
this.client.connect(connectCallback)
if (!!this.client) {
connectCallback(null, this.client);
} else {
//create one-off client
this.client = new this.pg.Client(uri)
this.client.connect(connectCallback)
}
}
return emitter
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!