1
0
Fork 0
mirror of synced 2024-06-25 17:40:38 +12:00

Fixing issue with Redis which was causing CPU peaking if couldn't connect.

This commit is contained in:
mike12345567 2021-06-25 15:32:59 +01:00
parent 164ac0de11
commit fd45ac86ab

View file

@ -18,6 +18,8 @@ function connectionError(timeout, err) {
if (CLOSED) {
return
}
CLIENT.end()
CLOSED = true
// always clear this on error
clearTimeout(timeout)
CONNECTED = false
@ -41,7 +43,7 @@ function init() {
// start the timer - only allowed 5 seconds to connect
timeout = setTimeout(() => {
if (!CONNECTED) {
connectionError(timeout)
connectionError(timeout, "Did not successfully connect in timeout")
}
}, STARTUP_TIMEOUT_MS)