mirror of
https://github.com/DeviceFarmer/stf.git
synced 2026-04-25 18:25:15 +02:00
Don't attempt to reconnect to the db when we're dying.
This commit is contained in:
@@ -49,8 +49,10 @@ function connect() {
|
||||
db.connect = (function() {
|
||||
var connection
|
||||
var queue = []
|
||||
var goingDown = false
|
||||
|
||||
lifecycle.observe(function() {
|
||||
goingDown = true
|
||||
if (connection) {
|
||||
return connection.close()
|
||||
}
|
||||
@@ -65,7 +67,9 @@ db.connect = (function() {
|
||||
log.warn('Connection closed')
|
||||
connection = null
|
||||
conn.removeListener('close', closeListener)
|
||||
createConnection()
|
||||
if (!goingDown) {
|
||||
createConnection()
|
||||
}
|
||||
})
|
||||
|
||||
queue.splice(0).forEach(function(resolver) {
|
||||
|
||||
Reference in New Issue
Block a user