MCPcopy
hub / github.com/puma/puma-dev / Kill

Method Kill

dev/app.go:86–108  ·  view source on GitHub ↗
(reason string)

Source from the content-addressed store, hash-verified

84}
85
86func (a *App) Kill(reason string) error {
87 a.eventAdd("killing_app",
88 "pid", a.Command.Process.Pid,
89 "reason", reason,
90 )
91
92 fmt.Printf("! Killing '%s' (%d) - '%s'\n", a.Name, a.Command.Process.Pid, reason)
93 err := a.Command.Process.Signal(syscall.SIGTERM)
94 if err != nil {
95 a.eventAdd("killing_error",
96 "pid", a.Command.Process.Pid,
97 "error", err.Error(),
98 )
99 fmt.Printf("! Error trying to kill %s: %s", a.Name, err)
100 } else {
101 // sigterm successful -- now that this app is stopped, remove it
102 // from pool so it is guaranteed be booted on the next request
103 a.pool.remove(a)
104 a.eventAdd("shutdown")
105 }
106
107 return err
108}
109
110func (a *App) watch() error {
111 c := make(chan error)

Callers 4

watchMethod · 0.95
idleMonitorMethod · 0.95
restartMonitorMethod · 0.95
PurgeMethod · 0.80

Calls 2

eventAddMethod · 0.95
removeMethod · 0.80

Tested by

no test coverage detected