Mercurial > hg > nginx-quic
comparison src/http/ngx_http_file_cache.c @ 3885:46938b7418c6
fix CPU hog in cache manager
patch by Maxim Dounin
author | Igor Sysoev <igor@sysoev.ru> |
---|---|
date | Fri, 08 Apr 2011 15:27:53 +0000 |
parents | 76e3a93821b1 |
children | e7cd13b7f759 |
comparison
equal
deleted
inserted
replaced
3884:ea712f4dc030 | 3885:46938b7418c6 |
---|---|
1025 fcn->count, fcn->exists, | 1025 fcn->count, fcn->exists, |
1026 fcn->key[0], fcn->key[1], fcn->key[2], fcn->key[3]); | 1026 fcn->key[0], fcn->key[1], fcn->key[2], fcn->key[3]); |
1027 | 1027 |
1028 if (fcn->count == 0) { | 1028 if (fcn->count == 0) { |
1029 ngx_http_file_cache_delete(cache, q, name); | 1029 ngx_http_file_cache_delete(cache, q, name); |
1030 wait = 0; | |
1030 | 1031 |
1031 } else { | 1032 } else { |
1032 if (--tries) { | 1033 if (--tries) { |
1033 continue; | 1034 continue; |
1034 } | 1035 } |
1189 ngx_http_file_cache_manager(void *data) | 1190 ngx_http_file_cache_manager(void *data) |
1190 { | 1191 { |
1191 ngx_http_file_cache_t *cache = data; | 1192 ngx_http_file_cache_t *cache = data; |
1192 | 1193 |
1193 off_t size; | 1194 off_t size; |
1194 time_t next; | 1195 time_t next, wait; |
1195 | 1196 |
1196 next = ngx_http_file_cache_expire(cache); | 1197 next = ngx_http_file_cache_expire(cache); |
1197 | 1198 |
1198 cache->last = ngx_current_msec; | 1199 cache->last = ngx_current_msec; |
1199 cache->files = 0; | 1200 cache->files = 0; |
1210 | 1211 |
1211 if (size < cache->max_size) { | 1212 if (size < cache->max_size) { |
1212 return next; | 1213 return next; |
1213 } | 1214 } |
1214 | 1215 |
1215 next = ngx_http_file_cache_forced_expire(cache); | 1216 wait = ngx_http_file_cache_forced_expire(cache); |
1217 | |
1218 if (wait > 0) { | |
1219 return wait; | |
1220 } | |
1216 | 1221 |
1217 if (ngx_http_file_cache_manager_sleep(cache) != NGX_OK) { | 1222 if (ngx_http_file_cache_manager_sleep(cache) != NGX_OK) { |
1218 return next; | 1223 return next; |
1219 } | 1224 } |
1220 } | 1225 } |