Permalink
Browse files

Fix compatibility with nginx-1.1.12+.

Due to the changes in cache index usage accounting (1 per request
instead of 1 per access) initial cache insert of "small" file was
decreasing usage count, rendering index entry invalid.

Because cache manager ignores invalid entries, expired cache files
were not being removed from the cache, which forced it to outgrow
specified "max_size" value.

Change-Id: Ifd22d0ba53bed270109241a014eec2a6b0b2950d
Signed-off-by: Piotr Sikora <piotr.sikora@frickle.com>
1 parent 7b0a354 commit 58000766d900732d0e801f0bcbb96a5f45ad3685 @PiotrSikora PiotrSikora committed Mar 7, 2013
Showing with 6 additions and 0 deletions.
  1. +6 −0 ngx_http_slowfs_module.c
View
@@ -384,6 +384,12 @@ ngx_http_slowfs_static_send(ngx_http_request_t *r)
old_status = slowctx->cache_status;
#endif
+#if defined(nginx_version) && (nginx_version >= 1001012)
+ ngx_shmtx_lock(&c->file_cache->shpool->mutex);
+ c->node->count++;
+ ngx_shmtx_unlock(&c->file_cache->shpool->mutex);
+#endif
+
ngx_http_slowfs_cache_update(r, &of, &path);
/* Allow cache_cleanup after cache_update. */
c->updated = 0;

0 comments on commit 5800076

Please sign in to comment.