aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/http/ngx_http_upstream.c19
1 files changed, 8 insertions, 11 deletions
diff --git a/src/http/ngx_http_upstream.c b/src/http/ngx_http_upstream.c
index 925824366..ffb09a91f 100644
--- a/src/http/ngx_http_upstream.c
+++ b/src/http/ngx_http_upstream.c
@@ -597,10 +597,6 @@ ngx_http_upstream_init_request(ngx_http_request_t *r)
u->cache_status = NGX_HTTP_CACHE_MISS;
u->request_sent = 1;
}
-
- if (ngx_http_upstream_cache_background_update(r, u) != NGX_OK) {
- rc = NGX_ERROR;
- }
}
if (rc != NGX_DECLINED) {
@@ -902,9 +898,14 @@ ngx_http_upstream_cache(ngx_http_request_t *r, ngx_http_upstream_t *u)
|| c->stale_updating) && !r->background
&& u->conf->cache_background_update)
{
- r->cache->background = 1;
- u->cache_status = rc;
- rc = NGX_OK;
+ if (ngx_http_upstream_cache_background_update(r, u) == NGX_OK) {
+ r->cache->background = 1;
+ u->cache_status = rc;
+ rc = NGX_OK;
+
+ } else {
+ rc = NGX_ERROR;
+ }
}
break;
@@ -1106,10 +1107,6 @@ ngx_http_upstream_cache_background_update(ngx_http_request_t *r,
{
ngx_http_request_t *sr;
- if (!r->cached || !r->cache->background) {
- return NGX_OK;
- }
-
if (r == r->main) {
r->preserve_body = 1;
}