#96 修复缓存查询promise_allow_many_successes,但未调用promise_finish。
This commit is contained in:
@@ -885,7 +885,8 @@ static void cache_query_obj_on_succ(future_result_t * result, void * user)
|
||||
case RESULT_TYPE_END:
|
||||
//last call.
|
||||
ATOMIC_DEC(&(ctx->ref_handle->stat_val[STAT_CACHE_READING]));
|
||||
promise_dettach_ctx(p);
|
||||
promise_dettach_ctx(p);
|
||||
promise_finish(p);
|
||||
last_call=1;
|
||||
break;
|
||||
case RESULT_TYPE_BODY:
|
||||
@@ -903,7 +904,8 @@ static void cache_query_obj_on_fail(enum e_future_error err, const char * what,
|
||||
{
|
||||
struct promise * p = (struct promise *) user;
|
||||
struct cache_query_context* ctx=(struct cache_query_context*)promise_dettach_ctx(p);
|
||||
promise_failed(p, err, what);
|
||||
promise_failed(p, err, what);
|
||||
promise_finish(p);
|
||||
ATOMIC_DEC(&(ctx->ref_handle->stat_val[STAT_CACHE_READING]));
|
||||
cache_query_ctx_free_cb(ctx);
|
||||
return;
|
||||
@@ -1189,7 +1191,7 @@ struct wrap_cache_put_ctx
|
||||
struct future* f;
|
||||
struct cache_handle* ref_handle;
|
||||
};
|
||||
void wrap_cache_put_ctx_free(struct wrap_cache_put_ctx* ctx)
|
||||
void wrap_cache_write_ctx_free(struct wrap_cache_put_ctx* ctx)
|
||||
{
|
||||
FREE(&(ctx->url));
|
||||
future_destroy(ctx->f);
|
||||
@@ -1199,13 +1201,13 @@ static void wrap_cache_write_on_succ(future_result_t * result, void * user)
|
||||
{
|
||||
struct wrap_cache_put_ctx* ctx=(struct wrap_cache_put_ctx*)user;
|
||||
TFE_LOG_DEBUG(ctx->ref_handle->logger, "cache upload success: %s elapse: %d", ctx->url, time(NULL)-ctx->start);
|
||||
wrap_cache_put_ctx_free(ctx);
|
||||
wrap_cache_write_ctx_free(ctx);
|
||||
}
|
||||
static void wrap_cache_write_on_fail(enum e_future_error err, const char * what, void * user)
|
||||
{
|
||||
struct wrap_cache_put_ctx* ctx=(struct wrap_cache_put_ctx*)user;
|
||||
TFE_LOG_DEBUG(ctx->ref_handle->logger, "cache upload failed: %s %s lapse: %d", ctx->url, what, time(NULL)-ctx->start);
|
||||
wrap_cache_put_ctx_free(ctx);
|
||||
wrap_cache_write_ctx_free(ctx);
|
||||
}
|
||||
|
||||
struct cache_update_context* web_cache_write_start(struct cache_handle* handle, unsigned int thread_id,
|
||||
@@ -1325,7 +1327,7 @@ struct cache_update_context* web_cache_write_start(struct cache_handle* handle,
|
||||
write_ctx=tango_cache_update_start(handle->clients[thread_id], _cache_put_ctx->f, &meta);
|
||||
if(write_ctx==NULL)//exceed maximum cache memory size.
|
||||
{
|
||||
wrap_cache_put_ctx_free(_cache_put_ctx);
|
||||
wrap_cache_write_ctx_free(_cache_put_ctx);
|
||||
return NULL;
|
||||
}
|
||||
TFE_LOG_DEBUG(handle->logger, "cache upload allowed: %s", _cache_put_ctx->url);
|
||||
|
||||
Reference in New Issue
Block a user