2
0
mirror of https://github.com/hibiken/asynq.git synced 2024-09-20 02:55:54 +08:00

(fix): Change log messages depending on signals being handled

This commit is contained in:
Ken Hibino 2020-04-10 08:47:43 -07:00
parent 84b0c76c8b
commit 7e96e893fe
3 changed files with 4 additions and 3 deletions

View File

@ -247,9 +247,6 @@ func (bg *Background) Run(handler Handler) {
bg.start(handler)
defer bg.stop()
bg.logger.Info("Send signal TSTP to stop processing new tasks")
bg.logger.Info("Send signal TERM or INT to terminate the process")
bg.waitForSignals()
fmt.Println()
bg.logger.Info("Starting graceful shutdown")

View File

@ -16,6 +16,9 @@ import (
// SIGTERM and SIGINT will signal the process to exit.
// SIGTSTP will signal the process to stop processing new tasks.
func (bg *Background) waitForSignals() {
bg.logger.Info("Send signal TSTP to stop processing new tasks")
bg.logger.Info("Send signal TERM or INT to terminate the process")
sigs := make(chan os.Signal, 1)
signal.Notify(sigs, unix.SIGTERM, unix.SIGINT, unix.SIGTSTP)
for {

View File

@ -15,6 +15,7 @@ import (
//
// Note: Currently SIGTSTP is not supported for windows build.
func (bg *Background) waitForSignals() {
bg.logger.Info("Send signal TERM or INT to terminate the process")
sigs := make(chan os.Signal, 1)
signal.Notify(sigs, windows.SIGTERM, windows.SIGINT)
<-sigs