diff options
| author | Igor Sysoev <igor@sysoev.ru> | 2009-06-06 18:49:47 +0000 |
|---|---|---|
| committer | Igor Sysoev <igor@sysoev.ru> | 2009-06-06 18:49:47 +0000 |
| commit | 55192e74706f328a53db6173c50ba03af9582253 (patch) | |
| tree | 065b5fe0a8e1ac1a8254fc5525532e2ec5236cb0 /src/http/ngx_http_file_cache.c | |
| parent | fa524e9063212bf021aa557a0e42b2b0c06f3982 (diff) | |
| download | nginx-55192e74706f328a53db6173c50ba03af9582253.tar.gz nginx-55192e74706f328a53db6173c50ba03af9582253.tar.bz2 | |
proxy_cache_use_stale/fastcgi_cache_use_stale updating
Diffstat (limited to 'src/http/ngx_http_file_cache.c')
| -rw-r--r-- | src/http/ngx_http_file_cache.c | 23 |
1 files changed, 20 insertions, 3 deletions
diff --git a/src/http/ngx_http_file_cache.c b/src/http/ngx_http_file_cache.c index 8c944aed3..248cd9455 100644 --- a/src/http/ngx_http_file_cache.c +++ b/src/http/ngx_http_file_cache.c @@ -331,10 +331,23 @@ ngx_http_file_cache_open(ngx_http_request_t *r) if (c->valid_sec < now) { - ngx_log_debug2(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, - "http file cache expired: %T %T", c->valid_sec, now); + ngx_shmtx_lock(&cache->shpool->mutex); + + if (c->node->updating) { + rc = NGX_HTTP_CACHE_UPDATING; + + } else { + c->node->updating = 1; + rc = NGX_HTTP_CACHE_STALE; + } - return NGX_HTTP_CACHE_STALE; + ngx_shmtx_unlock(&cache->shpool->mutex); + + ngx_log_debug3(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, + "http file cache expired: %i %T %T", + rc, c->valid_sec, now); + + return rc; } return NGX_OK; @@ -648,6 +661,8 @@ ngx_http_file_cache_update(ngx_http_request_t *r, ngx_temp_file_t *tf) c->node->exists = 1; } + c->node->updating = 0; + ngx_shmtx_unlock(&cache->shpool->mutex); } @@ -730,6 +745,8 @@ ngx_http_file_cache_free(ngx_http_request_t *r, ngx_temp_file_t *tf) c->node->error = c->error; } + c->node->updating = 0; + ngx_shmtx_unlock(&cache->shpool->mutex); if (c->temp_file) { |
