Skip to content

Commit

Permalink
Expose graceful shutdown timeout in flag
Browse files Browse the repository at this point in the history
  • Loading branch information
csstaub committed Apr 12, 2016
1 parent 75a5025 commit ba4741a
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
1 change: 1 addition & 0 deletions main.go
Expand Up @@ -71,6 +71,7 @@ var (
keystorePass = app.Flag("storepass", "Password for certificate and keystore (optional).").PlaceHolder("PASS").String()
caBundlePath = app.Flag("cacert", "Path to certificate authority bundle file (PEM/X509).").Required().String()
timedReload = app.Flag("timed-reload", "Reload keystores every N seconds, refresh listener/client on changes.").PlaceHolder("N").Int()
shutdownTimeout = app.Flag("shutdown-timeout", "Graceful shutdown timeout. Terminates after timeout even if connections still open.").Default("5m").Duration()
timeoutDuration = app.Flag("timeout", "Timeout for establishing connections, handshakes.").Default("10s").Duration()
graphiteAddr = app.Flag("graphite", "Collect metrics and report them to the given graphite instance (raw TCP).").PlaceHolder("ADDR").TCP()
metricsURL = app.Flag("metrics-url", "Collect metrics and POST them periodically to the given URL (via HTTP/JSON).").PlaceHolder("URL").String()
Expand Down
4 changes: 2 additions & 2 deletions signals.go
Expand Up @@ -46,7 +46,7 @@ func serverSignalHandler(listener net.Listener, statusListener net.Listener, sto
switch sig {
case syscall.SIGTERM:
logger.Printf("received SIGTERM, stopping listener")
time.AfterFunc(5*time.Minute, func() {
time.AfterFunc(*shutdownTimeout, func() {
logger.Printf("graceful shutdown timeout: exiting")
exitFunc(1)
})
Expand Down Expand Up @@ -95,7 +95,7 @@ func clientSignalHandler(listener net.Listener, reloadClient chan bool, stopper
switch sig {
case syscall.SIGTERM:
logger.Printf("received SIGTERM, stopping listener")
time.AfterFunc(5*time.Minute, func() {
time.AfterFunc(*shutdownTimeout, func() {
logger.Printf("graceful shutdown timeout: exiting")
exitFunc(1)
})
Expand Down

0 comments on commit ba4741a

Please sign in to comment.