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