From c3e2d79e837b165fceeacb4b1b8197af314b6df0 Mon Sep 17 00:00:00 2001 From: Pavel Rochnyack Date: Sun, 17 Jun 2018 16:10:54 +0700 Subject: [PATCH] redis plugin: Check for / report connection errors --- src/redis.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/redis.c b/src/redis.c index 68158ed2..9568fc57 100644 --- a/src/redis.c +++ b/src/redis.c @@ -423,8 +423,13 @@ static int redis_read(void) /* {{{ */ rh = redisConnectWithTimeout((char *)rn->host, rn->port, rn->timeout); if (rh == NULL) { - ERROR("redis plugin: unable to connect to node `%s' (%s:%d).", rn->name, - rn->host, rn->port); + ERROR("redis plugin: can't allocate redis context"); + continue; + } + if (rh->err) { + ERROR("redis plugin: unable to connect to node `%s' (%s:%d): %s.", + rn->name, rn->host, rn->port, rh->errstr); + redisFree(rh); continue; } -- 2.11.0