mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-07 20:31:06 -05:00
if redis fails once mark it to always fail
This commit is contained in:
parent
e133c7101e
commit
ef0ea2ace2
1 changed files with 5 additions and 1 deletions
|
@ -25,6 +25,7 @@ module.exports = RedisSharelatex =
|
|||
sub = RedisSharelatex.createClient(connectionInfo)
|
||||
pub = RedisSharelatex.createClient(connectionInfo)
|
||||
|
||||
redisIsOk = true
|
||||
heartbeatInterval = 2000 #ms
|
||||
isAliveTimeout = 10000 #ms
|
||||
|
||||
|
@ -45,8 +46,11 @@ module.exports = RedisSharelatex =
|
|||
|
||||
isAlive = ->
|
||||
timeSinceLastHeartbeat = Date.now() - lastHeartbeat
|
||||
if timeSinceLastHeartbeat > isAliveTimeout
|
||||
if !redisIsOk
|
||||
return false
|
||||
else if timeSinceLastHeartbeat > isAliveTimeout
|
||||
console.error "heartbeat from redis timed out"
|
||||
redisIsOk = false
|
||||
return false
|
||||
else
|
||||
return true
|
||||
|
|
Loading…
Reference in a new issue