Add Redis connection error message
This commit is contained in:
parent
4a43209386
commit
01faa784ea
1 changed files with 6 additions and 2 deletions
|
@ -17,8 +17,12 @@ proc setCacheTimes*(cfg: Config) =
|
||||||
listCacheTime = cfg.listCacheTime * 60
|
listCacheTime = cfg.listCacheTime * 60
|
||||||
|
|
||||||
proc initRedisPool*(cfg: Config) =
|
proc initRedisPool*(cfg: Config) =
|
||||||
|
try:
|
||||||
pool = waitFor newRedisPool(cfg.redisConns, maxConns=cfg.redisMaxConns,
|
pool = waitFor newRedisPool(cfg.redisConns, maxConns=cfg.redisMaxConns,
|
||||||
host=cfg.redisHost, port=cfg.redisPort)
|
host=cfg.redisHost, port=cfg.redisPort)
|
||||||
|
except OSError:
|
||||||
|
echo "Failed to connect to Redis."
|
||||||
|
quit()
|
||||||
|
|
||||||
template toKey(p: Profile): string = "p:" & toLower(p.username)
|
template toKey(p: Profile): string = "p:" & toLower(p.username)
|
||||||
template toKey(v: Video): string = "v:" & v.videoId
|
template toKey(v: Video): string = "v:" & v.videoId
|
||||||
|
|
Loading…
Reference in a new issue