Skip to content

Commit

Permalink
ndb_redis: redis_cmd() check reply type to detect command errors
Browse files Browse the repository at this point in the history
fix #2300
  • Loading branch information
linuxmaniac committed May 7, 2020
1 parent 10fd9fb commit d00b147
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions src/modules/ndb_redis/redis_client.c
Expand Up @@ -950,6 +950,14 @@ int redisc_exec(str *srv, str *res, str *cmd, ...)
goto error_exec;
}
}

LM_DBG("rpl->rplRedis->type:%d\n", rpl->rplRedis->type);
if(rpl->rplRedis->type == REDIS_REPLY_ERROR) {
LM_ERR("Redis error:%.*s\n",
(int)rpl->rplRedis->len, rpl->rplRedis->str);
goto error_exec;
}

if (check_cluster_reply(rpl->rplRedis, &rsrv)) {
LM_DBG("rsrv->ctxRedis = %p\n", rsrv->ctxRedis);
if(rsrv->ctxRedis==NULL)
Expand Down Expand Up @@ -984,6 +992,13 @@ int redisc_exec(str *srv, str *res, str *cmd, ...)
goto error_exec;
}
}

LM_DBG("rpl->rplRedis->type:%d\n", rpl->rplRedis->type);
if(rpl->rplRedis->type == REDIS_REPLY_ERROR) {
LM_ERR("Redis error:%.*s\n",
(int)rpl->rplRedis->len, rpl->rplRedis->str);
goto error_exec;
}
}
STR_ZTOV(cmd->s[cmd->len], c);
rsrv->disable.consecutive_errors = 0;
Expand Down

0 comments on commit d00b147

Please sign in to comment.