goreman
goreman copied to clipboard
Procfile configure problem
web5: go run web.go -a :$PORT
It will cause client hang while stop web5,because of "http://stackoverflow.com/questions/24982845/process-kill-on-child-processes"
We need compile web.go to solve this problem,like below web5: go run ./web -a :$PORT
I recommend add timeout feature for function stopProc
func stopProc(proc string, quit bool) error {
p, ok := procs[proc]
if !ok {
return errors.New("Unknown proc: " + proc)
}
p.mu.Lock()
defer p.mu.Unlock()
if p.cmd == nil {
return nil
}
p.quit = quit
err := terminateProc(proc)
if err != nil {
return err
}
var done = make(chan bool, 1)
go func(done chan bool) {
p.cond.Wait()
done <- true
}(done)
select {
case <-time.After(1 * time.Second):
p.cond.Signal()
<- done
err = errors.New("stop timeout")
case <-done:
err = nil
}
return err
}
goreman have implementation that send signal to process group. and have timeout already.