Commit 2e3f08b 1 parent 054165e commit 2e3f08b Copy full SHA for 2e3f08b
File tree 1 file changed +4
-1
lines changed
1 file changed +4
-1
lines changed Original file line number Diff line number Diff line change @@ -424,6 +424,7 @@ def stop(self, graceful=False):
424
424
self .scheduler .join ()
425
425
except KeyboardInterrupt :
426
426
self ._logger .info ('Received request to shut down now.' )
427
+ self ._restart = False
427
428
else :
428
429
self ._logger .info ('All workers have stopped.' )
429
430
else :
@@ -510,12 +511,14 @@ def check_worker_health(self):
510
511
511
512
def _set_signal_handlers (self ):
512
513
signal .signal (signal .SIGTERM , self ._handle_stop_signal )
513
- if self .worker_type == WORKER_GREENLET :
514
+ if self .worker_type in ( WORKER_GREENLET , WORKER_THREAD ) :
514
515
# Add a special INT handler when using gevent. If the running
515
516
# greenlet is not the main hub, then Gevent will raise a
516
517
# KeyboardInterrupt in the running greenlet by default. This
517
518
# ensures that when INT is received we properly flag the main loop
518
519
# for graceful shutdown and do NOT propagate the exception.
520
+ # This is also added for threads to ensure that, in the event of a
521
+ # SIGHUP followed by a SIGINT, we respect the SIGINT.
519
522
signal .signal (signal .SIGINT , self ._handle_interrupt_signal_gevent )
520
523
else :
521
524
signal .signal (signal .SIGINT , signal .default_int_handler )
You can’t perform that action at this time.
0 commit comments