Skip to content
This repository has been archived by the owner on Apr 19, 2024. It is now read-only.

Commit

Permalink
Respect SIGTERM from docker during shutdown
Browse files Browse the repository at this point in the history
  • Loading branch information
thrawn01 committed Dec 23, 2020
1 parent c77c8d0 commit 9a92025
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 8 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [1.0.0-rc.5] - 2020-12-21
### Change
* Respect SIGTERM from docker during shutdown.
* Peer info provided to etcd and memberlist pools is now consistent.
### Added
* Added GUBER_K8S_WATCH_MECHANISM for k8s deployments.

## [1.0.0-rc.4] - 2020-12-18
### Change
Expand Down
13 changes: 6 additions & 7 deletions cmd/gubernator/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import (
"os"
"os/signal"
"runtime"
"syscall"

"github.com/mailgun/gubernator"
"github.com/mailgun/holster/v3/clock"
Expand Down Expand Up @@ -62,13 +63,11 @@ func main() {

// Wait here for signals to clean up our mess
c := make(chan os.Signal, 1)
signal.Notify(c, os.Interrupt)
for sig := range c {
if sig == os.Interrupt {
log.Info("caught interrupt; user requested premature exit")
daemon.Close()
os.Exit(0)
}
signal.Notify(c, os.Interrupt, syscall.SIGTERM)
for range c {
log.Info("caught signal; shutting down")
daemon.Close()
os.Exit(0)
}
}

Expand Down
2 changes: 1 addition & 1 deletion etcd.go
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ func (e *EtcdPool) watch() error {

func (e *EtcdPool) register(peer PeerInfo) error {
instanceKey := e.conf.KeyPrefix + peer.GRPCAddress
e.log.Infof("Registering peer '%s' with etcd", peer)
e.log.Infof("Registering peer '%#v' with etcd", peer)

b, err := json.Marshal(peer)
if err != nil {
Expand Down

0 comments on commit 9a92025

Please sign in to comment.