... | ... |
@@ -1395,6 +1395,8 @@ function write_user_unit_file { |
1395 | 1395 |
iniset -sudo $unitfile "Unit" "Description" "Devstack $service" |
1396 | 1396 |
iniset -sudo $unitfile "Service" "User" "$user" |
1397 | 1397 |
iniset -sudo $unitfile "Service" "ExecStart" "$command" |
1398 |
+ iniset -sudo $unitfile "Service" "KillMode" "process" |
|
1399 |
+ iniset -sudo $unitfile "Service" "TimeoutStopSec" "infinity" |
|
1398 | 1400 |
if [[ -n "$group" ]]; then |
1399 | 1401 |
iniset -sudo $unitfile "Service" "Group" "$group" |
1400 | 1402 |
fi |
... | ... |
@@ -1417,7 +1419,7 @@ function write_uwsgi_user_unit_file { |
1417 | 1417 |
iniset -sudo $unitfile "Service" "User" "$user" |
1418 | 1418 |
iniset -sudo $unitfile "Service" "ExecStart" "$command" |
1419 | 1419 |
iniset -sudo $unitfile "Service" "Type" "notify" |
1420 |
- iniset -sudo $unitfile "Service" "KillSignal" "SIGQUIT" |
|
1420 |
+ iniset -sudo $unitfile "Service" "KillMode" "process" |
|
1421 | 1421 |
iniset -sudo $unitfile "Service" "Restart" "always" |
1422 | 1422 |
iniset -sudo $unitfile "Service" "NotifyAccess" "all" |
1423 | 1423 |
iniset -sudo $unitfile "Service" "RestartForceExitStatus" "100" |
... | ... |
@@ -260,10 +260,15 @@ function write_uwsgi_config { |
260 | 260 |
# Set die-on-term & exit-on-reload so that uwsgi shuts down |
261 | 261 |
iniset "$file" uwsgi die-on-term true |
262 | 262 |
iniset "$file" uwsgi exit-on-reload true |
263 |
+ # Set worker-reload-mercy so that worker will not exit till the time |
|
264 |
+ # configured after graceful shutdown |
|
265 |
+ iniset "$file" uwsgi worker-reload-mercy $WORKER_TIMEOUT |
|
263 | 266 |
iniset "$file" uwsgi enable-threads true |
264 | 267 |
iniset "$file" uwsgi plugins python |
265 | 268 |
# uwsgi recommends this to prevent thundering herd on accept. |
266 | 269 |
iniset "$file" uwsgi thunder-lock true |
270 |
+ # Set hook to trigger graceful shutdown on SIGTERM |
|
271 |
+ iniset "$file" uwsgi hook-master-start "unix_signal:15 gracefully_kill_them_all" |
|
267 | 272 |
# Override the default size for headers from the 4k default. |
268 | 273 |
iniset "$file" uwsgi buffer-size 65535 |
269 | 274 |
# Make sure the client doesn't try to re-use the connection. |
... | ... |
@@ -316,6 +321,11 @@ function write_local_uwsgi_http_config { |
316 | 316 |
iniset "$file" uwsgi plugins python |
317 | 317 |
# uwsgi recommends this to prevent thundering herd on accept. |
318 | 318 |
iniset "$file" uwsgi thunder-lock true |
319 |
+ # Set hook to trigger graceful shutdown on SIGTERM |
|
320 |
+ iniset "$file" uwsgi hook-master-start "unix_signal:15 gracefully_kill_them_all" |
|
321 |
+ # Set worker-reload-mercy so that worker will not exit till the time |
|
322 |
+ # configured after graceful shutdown |
|
323 |
+ iniset "$file" uwsgi worker-reload-mercy $WORKER_TIMEOUT |
|
319 | 324 |
# Override the default size for headers from the 4k default. |
320 | 325 |
iniset "$file" uwsgi buffer-size 65535 |
321 | 326 |
# Make sure the client doesn't try to re-use the connection. |
... | ... |
@@ -793,6 +793,9 @@ SERVICE_TIMEOUT=${SERVICE_TIMEOUT:-60} |
793 | 793 |
# Service graceful shutdown timeout |
794 | 794 |
SERVICE_GRACEFUL_SHUTDOWN_TIMEOUT=${SERVICE_GRACEFUL_SHUTDOWN_TIMEOUT:-5} |
795 | 795 |
|
796 |
+# Service graceful shutdown timeout |
|
797 |
+WORKER_TIMEOUT=${WORKER_TIMEOUT:-90} |
|
798 |
+ |
|
796 | 799 |
# Support alternative yum -- in future Fedora 'dnf' will become the |
797 | 800 |
# only supported installer, but for now 'yum' and 'dnf' are both |
798 | 801 |
# available in parallel with compatible CLIs. Allow manual switching |