comparison src/core/nginx.c @ 6930:97c99bb43737

Introduced worker_shutdown_timeout. The directive configures a timeout to be used when gracefully shutting down worker processes. When the timer expires, nginx will try to close all the connections currently open to facilitate shutdown.
author Maxim Dounin <mdounin@mdounin.ru>
date Tue, 07 Mar 2017 18:51:16 +0300
parents c045b4926b2c
children 69f9ee0342db
comparison
equal deleted inserted replaced
6929:3069dd358ba2 6930:97c99bb43737
120 { ngx_string("worker_rlimit_core"), 120 { ngx_string("worker_rlimit_core"),
121 NGX_MAIN_CONF|NGX_DIRECT_CONF|NGX_CONF_TAKE1, 121 NGX_MAIN_CONF|NGX_DIRECT_CONF|NGX_CONF_TAKE1,
122 ngx_conf_set_off_slot, 122 ngx_conf_set_off_slot,
123 0, 123 0,
124 offsetof(ngx_core_conf_t, rlimit_core), 124 offsetof(ngx_core_conf_t, rlimit_core),
125 NULL },
126
127 { ngx_string("worker_shutdown_timeout"),
128 NGX_MAIN_CONF|NGX_DIRECT_CONF|NGX_CONF_TAKE1,
129 ngx_conf_set_msec_slot,
130 0,
131 offsetof(ngx_core_conf_t, shutdown_timeout),
125 NULL }, 132 NULL },
126 133
127 { ngx_string("working_directory"), 134 { ngx_string("working_directory"),
128 NGX_MAIN_CONF|NGX_DIRECT_CONF|NGX_CONF_TAKE1, 135 NGX_MAIN_CONF|NGX_DIRECT_CONF|NGX_CONF_TAKE1,
129 ngx_conf_set_str_slot, 136 ngx_conf_set_str_slot,
1012 */ 1019 */
1013 1020
1014 ccf->daemon = NGX_CONF_UNSET; 1021 ccf->daemon = NGX_CONF_UNSET;
1015 ccf->master = NGX_CONF_UNSET; 1022 ccf->master = NGX_CONF_UNSET;
1016 ccf->timer_resolution = NGX_CONF_UNSET_MSEC; 1023 ccf->timer_resolution = NGX_CONF_UNSET_MSEC;
1024 ccf->shutdown_timeout = NGX_CONF_UNSET_MSEC;
1017 1025
1018 ccf->worker_processes = NGX_CONF_UNSET; 1026 ccf->worker_processes = NGX_CONF_UNSET;
1019 ccf->debug_points = NGX_CONF_UNSET; 1027 ccf->debug_points = NGX_CONF_UNSET;
1020 1028
1021 ccf->rlimit_nofile = NGX_CONF_UNSET; 1029 ccf->rlimit_nofile = NGX_CONF_UNSET;
1040 ngx_core_conf_t *ccf = conf; 1048 ngx_core_conf_t *ccf = conf;
1041 1049
1042 ngx_conf_init_value(ccf->daemon, 1); 1050 ngx_conf_init_value(ccf->daemon, 1);
1043 ngx_conf_init_value(ccf->master, 1); 1051 ngx_conf_init_value(ccf->master, 1);
1044 ngx_conf_init_msec_value(ccf->timer_resolution, 0); 1052 ngx_conf_init_msec_value(ccf->timer_resolution, 0);
1053 ngx_conf_init_msec_value(ccf->shutdown_timeout, 0);
1045 1054
1046 ngx_conf_init_value(ccf->worker_processes, 1); 1055 ngx_conf_init_value(ccf->worker_processes, 1);
1047 ngx_conf_init_value(ccf->debug_points, 0); 1056 ngx_conf_init_value(ccf->debug_points, 0);
1048 1057
1049 #if (NGX_HAVE_CPU_AFFINITY) 1058 #if (NGX_HAVE_CPU_AFFINITY)