mirror of
https://github.com/hibiken/asynq.git
synced 2024-12-25 07:12:17 +08:00
(fix): Change log messages depending on signals being handled
This commit is contained in:
parent
84b0c76c8b
commit
7e96e893fe
@ -247,9 +247,6 @@ func (bg *Background) Run(handler Handler) {
|
|||||||
bg.start(handler)
|
bg.start(handler)
|
||||||
defer bg.stop()
|
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()
|
bg.waitForSignals()
|
||||||
fmt.Println()
|
fmt.Println()
|
||||||
bg.logger.Info("Starting graceful shutdown")
|
bg.logger.Info("Starting graceful shutdown")
|
||||||
|
@ -16,6 +16,9 @@ import (
|
|||||||
// SIGTERM and SIGINT will signal the process to exit.
|
// SIGTERM and SIGINT will signal the process to exit.
|
||||||
// SIGTSTP will signal the process to stop processing new tasks.
|
// SIGTSTP will signal the process to stop processing new tasks.
|
||||||
func (bg *Background) waitForSignals() {
|
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)
|
sigs := make(chan os.Signal, 1)
|
||||||
signal.Notify(sigs, unix.SIGTERM, unix.SIGINT, unix.SIGTSTP)
|
signal.Notify(sigs, unix.SIGTERM, unix.SIGINT, unix.SIGTSTP)
|
||||||
for {
|
for {
|
||||||
|
@ -15,6 +15,7 @@ import (
|
|||||||
//
|
//
|
||||||
// Note: Currently SIGTSTP is not supported for windows build.
|
// Note: Currently SIGTSTP is not supported for windows build.
|
||||||
func (bg *Background) waitForSignals() {
|
func (bg *Background) waitForSignals() {
|
||||||
|
bg.logger.Info("Send signal TERM or INT to terminate the process")
|
||||||
sigs := make(chan os.Signal, 1)
|
sigs := make(chan os.Signal, 1)
|
||||||
signal.Notify(sigs, windows.SIGTERM, windows.SIGINT)
|
signal.Notify(sigs, windows.SIGTERM, windows.SIGINT)
|
||||||
<-sigs
|
<-sigs
|
||||||
|
Loading…
Reference in New Issue
Block a user