comparison src/http/ngx_http_file_cache.c @ 478:f2c6a7373274 NGINX_0_7_51

nginx 0.7.51 *) Feature: the "try_files" directive supports a response code in the fallback parameter. *) Feature: now any response code can be used in the "return" directive. *) Bugfix: the "error_page" directive made an external redirect without query string; the bug had appeared in 0.7.44. *) Bugfix: if servers listened on several defined explicitly addresses, then virtual servers might not work; the bug had appeared in 0.7.39.
author Igor Sysoev <http://sysoev.ru>
date Sun, 12 Apr 2009 00:00:00 +0400
parents 09f0ef15d544
children 549994537f15
comparison
equal deleted inserted replaced
477:ba2ea8c4d60f 478:f2c6a7373274
415 fcn = ngx_slab_alloc_locked(cache->shpool, 415 fcn = ngx_slab_alloc_locked(cache->shpool,
416 sizeof(ngx_http_file_cache_node_t)); 416 sizeof(ngx_http_file_cache_node_t));
417 if (fcn == NULL) { 417 if (fcn == NULL) {
418 ngx_shmtx_unlock(&cache->shpool->mutex); 418 ngx_shmtx_unlock(&cache->shpool->mutex);
419 419
420 ngx_http_file_cache_forced_expire(cache); 420 (void) ngx_http_file_cache_forced_expire(cache);
421 421
422 ngx_shmtx_lock(&cache->shpool->mutex); 422 ngx_shmtx_lock(&cache->shpool->mutex);
423 423
424 fcn = ngx_slab_alloc_locked(cache->shpool, 424 fcn = ngx_slab_alloc_locked(cache->shpool,
425 sizeof(ngx_http_file_cache_node_t)); 425 sizeof(ngx_http_file_cache_node_t));
816 path = cache->path; 816 path = cache->path;
817 len = path->name.len + 1 + path->len + 2 * NGX_HTTP_CACHE_KEY_LEN; 817 len = path->name.len + 1 + path->len + 2 * NGX_HTTP_CACHE_KEY_LEN;
818 818
819 name = ngx_alloc(len + 1, ngx_cycle->log); 819 name = ngx_alloc(len + 1, ngx_cycle->log);
820 if (name == NULL) { 820 if (name == NULL) {
821 return 60; 821 return 10;
822 } 822 }
823 823
824 ngx_memcpy(name, path->name.data, path->name.len); 824 ngx_memcpy(name, path->name.data, path->name.len);
825 825
826 wait = 60; 826 wait = 10;
827 tries = 0; 827 tries = 0;
828 828
829 ngx_shmtx_lock(&cache->shpool->mutex); 829 ngx_shmtx_lock(&cache->shpool->mutex);
830 830
831 for (q = ngx_queue_last(cache->queue); 831 for (q = ngx_queue_last(cache->queue);
889 path = cache->path; 889 path = cache->path;
890 len = path->name.len + 1 + path->len + 2 * NGX_HTTP_CACHE_KEY_LEN; 890 len = path->name.len + 1 + path->len + 2 * NGX_HTTP_CACHE_KEY_LEN;
891 891
892 name = ngx_alloc(len + 1, ngx_cycle->log); 892 name = ngx_alloc(len + 1, ngx_cycle->log);
893 if (name == NULL) { 893 if (name == NULL) {
894 return 60; 894 return 10;
895 } 895 }
896 896
897 ngx_memcpy(name, path->name.data, path->name.len); 897 ngx_memcpy(name, path->name.data, path->name.len);
898 898
899 now = ngx_time(); 899 now = ngx_time();
901 ngx_shmtx_lock(&cache->shpool->mutex); 901 ngx_shmtx_lock(&cache->shpool->mutex);
902 902
903 for ( ;; ) { 903 for ( ;; ) {
904 904
905 if (ngx_queue_empty(cache->queue)) { 905 if (ngx_queue_empty(cache->queue)) {
906 wait = 60; 906 wait = 10;
907 break; 907 break;
908 } 908 }
909 909
910 q = ngx_queue_last(cache->queue); 910 q = ngx_queue_last(cache->queue);
911 911
912 fcn = ngx_queue_data(q, ngx_http_file_cache_node_t, queue); 912 fcn = ngx_queue_data(q, ngx_http_file_cache_node_t, queue);
913 913
914 wait = fcn->expire - now; 914 wait = fcn->expire - now;
915 915
916 if (wait > 0) { 916 if (wait > 0) {
917 wait = wait > 60 ? 60 : wait; 917 wait = wait > 10 ? 10 : wait;
918 break; 918 break;
919 } 919 }
920 920
921 ngx_log_debug6(NGX_LOG_DEBUG_HTTP, ngx_cycle->log, 0, 921 ngx_log_debug6(NGX_LOG_DEBUG_HTTP, ngx_cycle->log, 0,
922 "http file cache expire: #%d %d %02xd%02xd%02xd%02xd", 922 "http file cache expire: #%d %d %02xd%02xd%02xd%02xd",
1040 1040
1041 cache->last = ngx_current_msec; 1041 cache->last = ngx_current_msec;
1042 cache->files = 0; 1042 cache->files = 0;
1043 1043
1044 if (ngx_walk_tree(&tree, &cache->path->name) == NGX_ABORT) { 1044 if (ngx_walk_tree(&tree, &cache->path->name) == NGX_ABORT) {
1045 return 60; 1045 return 10;
1046 } 1046 }
1047 1047
1048 *cache->cold = 0; 1048 *cache->cold = 0;
1049 1049
1050 ngx_log_error(NGX_LOG_NOTICE, ngx_cycle->log, 0, 1050 ngx_log_error(NGX_LOG_NOTICE, ngx_cycle->log, 0,