graceful

command
v0.0.0-...-c93e153 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 24, 2018 License: MIT Imports: 8 Imported by: 0

README

12.5 Server::Starter対応のGracefull Shutdownをするサーバーの簡易実装

Server::Starter提供のソケットを使って起動してhttp.Server.Shutdown()メソッドを使ってGraceful Shutdownを実行する。

$ go get github.com/lestrrat/go-server-starter/cmd/start_server
$ go build -o server main.go
$ start_server --port 8080 --pid-file app.pid -- ./server
$ start_server --port 8080 --pid-file app.pid -- ./server
starting new worker 82738
---------------------------------------Other terminal
$ cat app.pid
82737%
$ kill -HUP `cat app.pid`
---------------------------------------
received HUP (num_old_workers=TODO)
spawning a new worker (num_old_workers=TODO)
starting new worker 86037
new worker is now running, sending TERM to old workers:82738
sleep 0 secs
killing old workers
old worker 82738 died, status:0
^Creceived INT, sending TERM to all workers:86037
worker 86037 died, status:2
exiting

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL