Skip to content

Commit 04d62a7

Browse files
committed
Fix on-disk cache size calculation.
Since the initial release, recorded on-disk cache size was decreased twice for purged content (once during cache purge and once during subsequent cache update). This resulted in recorded on-disk cache size being much smaller than in reality, which could lead to on-disk cache outgrowing defined "max_size" parameter. Based on patch from Pyry Hakulinen. Change-Id: I13d99311d01c63f14362d995ff8dc7654ea78e0d Signed-off-by: Piotr Sikora <[email protected]>
1 parent 4f6bfe5 commit 04d62a7

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

ngx_cache_purge_module.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -757,8 +757,10 @@ ngx_http_file_cache_purge(ngx_http_request_t *r)
757757

758758
# if defined(nginx_version) && (nginx_version >= 1000001)
759759
cache->sh->size -= c->node->fs_size;
760+
c->node->fs_size = 0;
760761
# else
761762
cache->sh->size -= (c->node->length + cache->bsize - 1) / cache->bsize;
763+
c->node->length = 0;
762764
# endif
763765

764766
c->node->exists = 0;

0 commit comments

Comments
 (0)