1. 修复命中缓存策略后,缓存上传的处理逻辑
2. 支持新版本的FieldStat的Histogram输出
This commit is contained in:
@@ -440,7 +440,6 @@ struct pangu_http_ctx
|
||||
size_t datalen, unsigned int thread_id, struct pangu_http_ctx* ctx);
|
||||
|
||||
enum cache_pending_result pending_result;
|
||||
enum cache_query_status cache_query_status;
|
||||
struct future *f_cache_pending, *f_cache_query;
|
||||
struct tfe_http_session * ref_session;
|
||||
struct tfe_http_half* cache_revalidate_req;
|
||||
@@ -1085,16 +1084,16 @@ static void cache_query_on_succ(future_result_t * result, void * user)
|
||||
break;
|
||||
case CACHE_QUERY_RESULT_END:
|
||||
assert(ctx->cached_response!=NULL);
|
||||
ctx->cache_query_status=WEB_CACHE_HIT;
|
||||
tfe_http_half_write_body_end(ctx->cached_response);
|
||||
//ownership has been transferred to http session, set to NULL.
|
||||
//ownership has been transferred to http session, set to NULL.
|
||||
ctx->pending_result=PENDING_RESULT_HIT;
|
||||
ctx->cached_response=NULL;
|
||||
assert(ctx->cache_result_actual_sz==ctx->cache_result_declared_sz);
|
||||
future_destroy(ctx->f_cache_query);
|
||||
ctx->f_cache_query=NULL;
|
||||
break;
|
||||
case CACHE_QUERY_RESULT_MISS:
|
||||
ctx->cache_query_status=WEB_CACHE_MISS;
|
||||
ctx->pending_result=PENDING_RESULT_MISS;
|
||||
ctx->resumed_cb=dummy_resume;
|
||||
tfe_http_session_resume(ctx->ref_session);
|
||||
future_destroy(ctx->f_cache_query);
|
||||
@@ -1110,7 +1109,6 @@ static void cache_query_on_fail(enum e_future_error err, const char * what, void
|
||||
struct pangu_http_ctx * ctx = (struct pangu_http_ctx *)user;
|
||||
future_destroy(ctx->f_cache_query);
|
||||
ctx->f_cache_query=NULL;
|
||||
ctx->cache_query_status=WEB_CACHE_MISS;
|
||||
if(!ctx->cached_response)
|
||||
{
|
||||
tfe_http_session_resume(ctx->ref_session);
|
||||
@@ -1121,7 +1119,7 @@ static void cache_query_on_fail(enum e_future_error err, const char * what, void
|
||||
tfe_http_half_write_body_end(ctx->cached_response);
|
||||
ctx->cached_response=NULL;
|
||||
}
|
||||
|
||||
ctx->pending_result=PENDING_RESULT_MISS;
|
||||
printf("cache query failed: %s %s\n", ctx->ref_session->req->req_spec.url, what);
|
||||
}
|
||||
static void cache_pending_on_succ(future_result_t * result, void * user)
|
||||
@@ -1346,7 +1344,8 @@ void pangu_on_http_data(const struct tfe_stream * stream, const struct tfe_http_
|
||||
}
|
||||
}
|
||||
|
||||
if(tfe_http_in_response(events)&& ctx->pending_result==PENDING_RESULT_MISS)
|
||||
if(tfe_http_in_response(events)
|
||||
&& (ctx->pending_result==PENDING_RESULT_MISS||ctx->pending_result==PENDING_RESULT_ALLOWED))
|
||||
{
|
||||
cache_update(session, events, body_frag, frag_size, thread_id, ctx);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user