mirror of
https://github.com/openresty/openresty.git
synced 2024-10-13 00:29:41 +00:00
upgraded the nginx core to 1.17.1.
This commit is contained in:
committed by
GitHub
parent
08e9e50782
commit
cef09e553f
53
patches/nginx-1.17.1-single_process_graceful_exit.patch
Normal file
53
patches/nginx-1.17.1-single_process_graceful_exit.patch
Normal file
@ -0,0 +1,53 @@
|
||||
diff --git a/src/os/unix/ngx_process_cycle.c b/src/os/unix/ngx_process_cycle.c
|
||||
index 1710ea81..b379da9c 100644
|
||||
--- a/src/os/unix/ngx_process_cycle.c
|
||||
+++ b/src/os/unix/ngx_process_cycle.c
|
||||
@@ -304,11 +304,26 @@ ngx_single_process_cycle(ngx_cycle_t *cycle)
|
||||
}
|
||||
|
||||
for ( ;; ) {
|
||||
+ if (ngx_exiting) {
|
||||
+ if (ngx_event_no_timers_left() == NGX_OK) {
|
||||
+ ngx_log_error(NGX_LOG_NOTICE, cycle->log, 0, "exiting");
|
||||
+
|
||||
+ for (i = 0; cycle->modules[i]; i++) {
|
||||
+ if (cycle->modules[i]->exit_process) {
|
||||
+ cycle->modules[i]->exit_process(cycle);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ ngx_master_process_exit(cycle);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
ngx_log_debug0(NGX_LOG_DEBUG_EVENT, cycle->log, 0, "worker cycle");
|
||||
|
||||
ngx_process_events_and_timers(cycle);
|
||||
|
||||
- if (ngx_terminate || ngx_quit) {
|
||||
+ if (ngx_terminate) {
|
||||
+ ngx_log_error(NGX_LOG_NOTICE, cycle->log, 0, "exiting");
|
||||
|
||||
for (i = 0; cycle->modules[i]; i++) {
|
||||
if (cycle->modules[i]->exit_process) {
|
||||
@@ -319,6 +334,20 @@ ngx_single_process_cycle(ngx_cycle_t *cycle)
|
||||
ngx_master_process_exit(cycle);
|
||||
}
|
||||
|
||||
+ if (ngx_quit) {
|
||||
+ ngx_quit = 0;
|
||||
+ ngx_log_error(NGX_LOG_NOTICE, cycle->log, 0,
|
||||
+ "gracefully shutting down");
|
||||
+ ngx_setproctitle("process is shutting down");
|
||||
+
|
||||
+ if (!ngx_exiting) {
|
||||
+ ngx_exiting = 1;
|
||||
+ ngx_set_shutdown_timer(cycle);
|
||||
+ ngx_close_listening_sockets(cycle);
|
||||
+ ngx_close_idle_connections(cycle);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
if (ngx_reconfigure) {
|
||||
ngx_reconfigure = 0;
|
||||
ngx_log_error(NGX_LOG_NOTICE, cycle->log, 0, "reconfiguring");
|
Reference in New Issue
Block a user