修复HEAD Redis时BUG
This commit is contained in:
17
cache/src/tango_cache_redis.cpp
vendored
17
cache/src/tango_cache_redis.cpp
vendored
@@ -65,7 +65,7 @@ void redis_asyn_connect_cb(const struct redisAsyncContext *ac, int status)
|
||||
}
|
||||
else
|
||||
{
|
||||
MESA_HANDLE_RUNTIME_LOGV2(instance->runtime_log, RLOG_LV_INFO, "Redis connect %s:%u failed.", instance->redis_ip, instance->redis_port, ac->errstr);
|
||||
MESA_HANDLE_RUNTIME_LOGV2(instance->runtime_log, RLOG_LV_INFO, "Redis connect %s:%u failed: %s.", instance->redis_ip, instance->redis_port, ac->errstr);
|
||||
instance->redis_connecting = CACHE_REDIS_CONNECT_IDLE;
|
||||
}
|
||||
}
|
||||
@@ -152,6 +152,7 @@ int parse_minio_events_json(struct tango_cache_ctx *ctx, const char *jcontent)
|
||||
easy_string_savedata(&ctx->response, "\r\n", strlen("\r\n"));
|
||||
}
|
||||
}
|
||||
cJSON_Delete(root);
|
||||
return PARSE_JSON_RET_SUCC;
|
||||
|
||||
out_json:
|
||||
@@ -167,7 +168,7 @@ void redis_hget_command_cb(struct redisAsyncContext *ac, void *vreply, void *pri
|
||||
|
||||
if(reply == NULL || reply->type!=REDIS_REPLY_STRING)
|
||||
{
|
||||
if(reply->type == REDIS_REPLY_NIL)
|
||||
if(reply!=NULL && reply->type == REDIS_REPLY_NIL)
|
||||
{
|
||||
tango_cache_set_fail_state(ctx, CACHE_CACHE_MISS);
|
||||
ctx->get.result.type = RESULT_TYPE_MISS;
|
||||
@@ -176,9 +177,15 @@ void redis_hget_command_cb(struct redisAsyncContext *ac, void *vreply, void *pri
|
||||
}
|
||||
else
|
||||
{
|
||||
if(ac->err) MESA_HANDLE_RUNTIME_LOGV2(ctx->instance->runtime_log, RLOG_LV_FATAL, "redis_hget_command_cb error: %s.", ac->errstr);
|
||||
tango_cache_set_fail_state(ctx, CACHE_ERR_REDIS_JSON);
|
||||
promise_failed(future_to_promise(ctx->future), FUTURE_ERROR_CANCEL, tango_cache_get_errstring(ctx));
|
||||
if(reply!=NULL && reply->type==REDIS_REPLY_ERROR)
|
||||
{
|
||||
promise_failed(future_to_promise(ctx->future), FUTURE_ERROR_CANCEL, reply->str);
|
||||
}
|
||||
else
|
||||
{
|
||||
promise_failed(future_to_promise(ctx->future), FUTURE_ERROR_CANCEL, tango_cache_get_errstring(ctx));
|
||||
}
|
||||
}
|
||||
tango_cache_ctx_destroy(ctx);
|
||||
return;
|
||||
@@ -221,7 +228,7 @@ int tango_cache_head_redis(struct tango_cache_ctx *ctx)
|
||||
ctx->instance->redis_key, ctx->instance->bucketname, ctx->object_key);
|
||||
if(ret < 0)
|
||||
{
|
||||
redisAsyncDisconnect(ctx->instance->redis_ac);
|
||||
//redisAsyncDisconnect(ctx->instance->redis_ac);
|
||||
redis_asyn_connect_init(ctx->instance, ctx->instance->redis_ip, ctx->instance->redis_port);
|
||||
tango_cache_set_fail_state(ctx, CACHE_ERR_REDIS_CONNECT);
|
||||
promise_failed(future_to_promise(ctx->future), FUTURE_ERROR_CANCEL, tango_cache_get_errstring(ctx));
|
||||
|
||||
Reference in New Issue
Block a user