You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I found that I used github.com/gocraft/work and there will be multiple processes. Note that this code will not be.
func main() {
gin.SetMode(gin.ReleaseMode)
go web.Start()
// Note that the following code will not appear multiple processes, just run the queue listener
queue := tasks.Queue{}
go queue.Start()
select {}
}
My guess is that package starts separate processes as workers. And since you aren't calling queue.Stop() when your program exists it doesn't kill those worker processes. Try something the following code:
funcmain() {
gin.SetMode(gin.ReleaseMode)
goweb.Start()
// Note that the following code will not appear multiple processes, just run the queue listenerqueue:= tasks.Queue{}
goqueue.Start()
c:=make(chan os.Signal, 1)
signal.Notify(c, os.Interrupt, os.Kill)
<-cqueue.Stop()
}
When two processes occur, the modified code will not take effect. You need to manually end the process and run it again.
The text was updated successfully, but these errors were encountered: