summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorzhengchao <[email protected]>2018-12-21 14:31:27 +0600
committerzhengchao <[email protected]>2018-12-21 14:31:27 +0600
commit5666787f67e6c5a9a6110e5dca349ec7b65de726 (patch)
tree526e9ae29d83c8ed797a8244648301b4965030e6
parent4a1b4adf35b715128033cbeb5705be945e500f29 (diff)
在线联调通过。修正force caching的优先级判断。
-rw-r--r--plugin/business/pangu-http/src/pangu_web_cache.cpp15
1 files changed, 11 insertions, 4 deletions
diff --git a/plugin/business/pangu-http/src/pangu_web_cache.cpp b/plugin/business/pangu-http/src/pangu_web_cache.cpp
index b824c1e..04fb972 100644
--- a/plugin/business/pangu-http/src/pangu_web_cache.cpp
+++ b/plugin/business/pangu-http/src/pangu_web_cache.cpp
@@ -1221,6 +1221,7 @@ static void wrap_cache_write_on_fail(enum e_future_error err, const char * what,
struct cache_write_future_ctx* ctx=(struct cache_write_future_ctx*)user;
TFE_LOG_DEBUG(ctx->ref_handle->logger, "cache upload failed: %s %s lapse: %d", ctx->url, what, time(NULL)-ctx->start);
cache_write_future_ctx_free(ctx);
+ ATOMIC_INC(&(ctx->ref_handle->stat_val[STAT_CACHE_WRITE_ERR]));
}
struct cache_write_context* web_cache_write_start(struct cache_handle* handle, unsigned int thread_id,
@@ -1268,11 +1269,16 @@ struct cache_write_context* web_cache_write_start(struct cache_handle* handle, u
case REVALIDATE:
case ALLOWED:
case UNDEFINED:
- if(_mid->shall_bypass
+ if(param->force_caching)
+ {
+ break;
+ }
+ else if(_mid->shall_bypass
|| (param->max_cache_obj_size!=0 && content_len > param->max_cache_obj_size)
|| (param->min_cache_obj_size > content_len)
|| (!param->cache_cookied_cont && _mid->has_cookie)
- || (!param->cache_html && _mid->is_html))
+ || (!param->cache_html && _mid->is_html)
+ )
{
ATOMIC_INC(&(handle->stat_val[STAT_CACHE_WRITE_BYPASS]));
return NULL;
@@ -1376,9 +1382,10 @@ void web_cache_write_end(struct cache_write_context* ctx)
if(ret<0)
{
//upload too slow or storage server error;
- cache_write_future_ctx_free(future_ctx);
TFE_LOG_DEBUG(ctx->ref_cache_handle->logger, "cache upload failed: %s",ctx->future_ctx->url);
- return;
+ cache_write_future_ctx_free(ctx->future_ctx);
+ ctx->future_ctx=NULL;
+ ATOMIC_INC(&(ctx->ref_cache_handle->stat_val[STAT_CACHE_WRITE_ERR]));
}
}
else