overleaf/services/real-time/app/coffee/RedisClientManager.coffee

18 lines
643 B
CoffeeScript
Raw Normal View History

redis = require("redis-sharelatex")
logger = require 'logger-sharelatex'
2019-07-09 07:20:59 -04:00
module.exports = RedisClientManager =
createClientList: (configs...) ->
# create a dynamic list of redis clients, excluding any configurations which are not defined
clientList = for x in configs when x?
redisType = if x.cluster?
"cluster"
else if x.sentinels?
"sentinel"
else if x.host?
"single"
else
"unknown"
logger.log {redis: redisType}, "creating redis client"
redis.createClient(x)
return clientList