Source File
signals_unix.go
Belonging Package
github.com/hibiken/asynq
//go:build linux || dragonfly || freebsd || netbsd || openbsd || darwinpackage asynqimport ()// waitForSignals waits for signals and handles them.// It handles SIGTERM, SIGINT, and SIGTSTP.// SIGTERM and SIGINT will signal the process to exit.// SIGTSTP will signal the process to stop processing new tasks.func ( *Server) () {.logger.Info("Send signal TSTP to stop processing new tasks").logger.Info("Send signal TERM or INT to terminate the process"):= make(chan os.Signal, 1)signal.Notify(, unix.SIGTERM, unix.SIGINT, unix.SIGTSTP)for {:= <-if == unix.SIGTSTP {.Stop()continue} else {.Stop()break}}}func ( *Scheduler) () {.logger.Info("Send signal TERM or INT to stop the scheduler"):= make(chan os.Signal, 1)signal.Notify(, unix.SIGTERM, unix.SIGINT)<-}
![]() |
The pages are generated with Golds v0.8.7. (GOOS=linux GOARCH=amd64) Golds is a Go 101 project developed by Tapir Liu. PR and bug reports are welcome and can be submitted to the issue list. Please follow @zigo_101 (reachable from the left QR code) to get the latest news of Golds. |