# HG changeset patch # User Igor Sysoev # Date 1302276473 0 # Node ID 46938b7418c6e3c9b96e9fc512b31e2886910ccd # Parent ea712f4dc030158a8149c184394da6b6c9657b46 fix CPU hog in cache manager patch by Maxim Dounin diff -r ea712f4dc030 -r 46938b7418c6 src/http/ngx_http_file_cache.c --- a/src/http/ngx_http_file_cache.c Thu Apr 07 09:12:30 2011 +0000 +++ b/src/http/ngx_http_file_cache.c Fri Apr 08 15:27:53 2011 +0000 @@ -1027,6 +1027,7 @@ if (fcn->count == 0) { ngx_http_file_cache_delete(cache, q, name); + wait = 0; } else { if (--tries) { @@ -1191,7 +1192,7 @@ ngx_http_file_cache_t *cache = data; off_t size; - time_t next; + time_t next, wait; next = ngx_http_file_cache_expire(cache); @@ -1212,7 +1213,11 @@ return next; } - next = ngx_http_file_cache_forced_expire(cache); + wait = ngx_http_file_cache_forced_expire(cache); + + if (wait > 0) { + return wait; + } if (ngx_http_file_cache_manager_sleep(cache) != NGX_OK) { return next;