2019-07-09 10:45:00 +00:00
|
|
|
redis = require("redis-sharelatex")
|
2019-07-09 13:18:39 +00:00
|
|
|
logger = require 'logger-sharelatex'
|
2019-07-09 10:45:00 +00:00
|
|
|
|
2019-07-09 11:20:59 +00:00
|
|
|
module.exports = RedisClientManager =
|
|
|
|
createClientList: (configs...) ->
|
2019-07-09 10:45:00 +00:00
|
|
|
# create a dynamic list of redis clients, excluding any configurations which are not defined
|
2019-07-09 13:18:39 +00:00
|
|
|
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)
|
2019-07-09 10:45:00 +00:00
|
|
|
return clientList
|