fix CPU hog in cache manager

patch by Maxim Dounin
This commit is contained in:
Igor Sysoev 2011-04-08 15:27:53 +00:00
parent ea38fe54bd
commit 711eeb8514

View File

@ -1027,6 +1027,7 @@ ngx_http_file_cache_forced_expire(ngx_http_file_cache_t *cache)
if (fcn->count == 0) { if (fcn->count == 0) {
ngx_http_file_cache_delete(cache, q, name); ngx_http_file_cache_delete(cache, q, name);
wait = 0;
} else { } else {
if (--tries) { if (--tries) {
@ -1191,7 +1192,7 @@ ngx_http_file_cache_manager(void *data)
ngx_http_file_cache_t *cache = data; ngx_http_file_cache_t *cache = data;
off_t size; off_t size;
time_t next; time_t next, wait;
next = ngx_http_file_cache_expire(cache); next = ngx_http_file_cache_expire(cache);
@ -1212,7 +1213,11 @@ ngx_http_file_cache_manager(void *data)
return next; 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) { if (ngx_http_file_cache_manager_sleep(cache) != NGX_OK) {
return next; return next;