diff 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
line wrap: on
line diff
--- a/src/core/nginx.c
+++ b/src/core/nginx.c
@@ -124,6 +124,13 @@ static ngx_command_t  ngx_core_commands[
       offsetof(ngx_core_conf_t, rlimit_core),
       NULL },
 
+    { ngx_string("worker_shutdown_timeout"),
+      NGX_MAIN_CONF|NGX_DIRECT_CONF|NGX_CONF_TAKE1,
+      ngx_conf_set_msec_slot,
+      0,
+      offsetof(ngx_core_conf_t, shutdown_timeout),
+      NULL },
+
     { ngx_string("working_directory"),
       NGX_MAIN_CONF|NGX_DIRECT_CONF|NGX_CONF_TAKE1,
       ngx_conf_set_str_slot,
@@ -1014,6 +1021,7 @@ ngx_core_module_create_conf(ngx_cycle_t 
     ccf->daemon = NGX_CONF_UNSET;
     ccf->master = NGX_CONF_UNSET;
     ccf->timer_resolution = NGX_CONF_UNSET_MSEC;
+    ccf->shutdown_timeout = NGX_CONF_UNSET_MSEC;
 
     ccf->worker_processes = NGX_CONF_UNSET;
     ccf->debug_points = NGX_CONF_UNSET;
@@ -1042,6 +1050,7 @@ ngx_core_module_init_conf(ngx_cycle_t *c
     ngx_conf_init_value(ccf->daemon, 1);
     ngx_conf_init_value(ccf->master, 1);
     ngx_conf_init_msec_value(ccf->timer_resolution, 0);
+    ngx_conf_init_msec_value(ccf->shutdown_timeout, 0);
 
     ngx_conf_init_value(ccf->worker_processes, 1);
     ngx_conf_init_value(ccf->debug_points, 0);