完善Redis错误处理。

This commit is contained in:
zhengchao
2018-02-27 19:31:19 +08:00
parent 93cb64e46f
commit 91a46e45bc
2 changed files with 9 additions and 2 deletions

View File

@@ -582,7 +582,14 @@ int _get_maat_redis_value(redisContext *c,struct serial_rule_t* rule_list,int ru
,rule_list[idx].table_name
,rule_list[idx].rule_id);
reply=_wrap_redisCommand(c, redis_cmd);
assert(reply->type==REDIS_REPLY_STRING);
if(reply->type!=REDIS_REPLY_STRING)//Handle: "Loading Redis is loading the database in memory" or "nil"
{
MESA_handle_runtime_log(logger,RLOG_LV_FATAL,maat_redis_monitor
,"Redis cmd=%s Error, Reply type=%d, str=%s",redis_cmd, reply->type, reply->str);
freeReplyObject(reply);
free(retry_ids);
return -1;
}
rule_list[idx].table_line=_maat_strdup(reply->str);
freeReplyObject(reply);
}