mirror of
https://github.com/nginx/nginx.git
synced 2025-06-07 17:52:38 +08:00
revert r3935 and fix "stalled cache updating" alert
by freeing cache at upstream finalize phase patch by Maxim Dounin
This commit is contained in:
parent
f58154db2f
commit
87ee007022
@ -2031,15 +2031,6 @@ ngx_http_upstream_send_response(ngx_http_request_t *r, ngx_http_upstream_t *u)
|
|||||||
c->error = 1;
|
c->error = 1;
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
#if (NGX_HTTP_CACHE)
|
|
||||||
|
|
||||||
if (r->cache) {
|
|
||||||
ngx_http_file_cache_free(r->cache, u->pipe->temp_file);
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
ngx_http_upstream_finalize_request(r, u, rc);
|
ngx_http_upstream_finalize_request(r, u, rc);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -2991,16 +2982,19 @@ ngx_http_upstream_finalize_request(ngx_http_request_t *r,
|
|||||||
|
|
||||||
#if (NGX_HTTP_CACHE)
|
#if (NGX_HTTP_CACHE)
|
||||||
|
|
||||||
if (u->cacheable && r->cache) {
|
if (r->cache) {
|
||||||
time_t valid;
|
|
||||||
|
|
||||||
if (rc == NGX_HTTP_BAD_GATEWAY || rc == NGX_HTTP_GATEWAY_TIME_OUT) {
|
if (u->cacheable) {
|
||||||
|
|
||||||
valid = ngx_http_file_cache_valid(u->conf->cache_valid, rc);
|
if (rc == NGX_HTTP_BAD_GATEWAY || rc == NGX_HTTP_GATEWAY_TIME_OUT) {
|
||||||
|
time_t valid;
|
||||||
|
|
||||||
if (valid) {
|
valid = ngx_http_file_cache_valid(u->conf->cache_valid, rc);
|
||||||
r->cache->valid_sec = ngx_time() + valid;
|
|
||||||
r->cache->error = rc;
|
if (valid) {
|
||||||
|
r->cache->valid_sec = ngx_time() + valid;
|
||||||
|
r->cache->error = rc;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user