Skip to content

Commit

Permalink
register for specific signals (#211)
Browse files Browse the repository at this point in the history
* register for specific signals

* Update CHANGELOG.md
  • Loading branch information
joe94 authored May 14, 2020
1 parent 76e8eab commit a43c582
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,12 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).

## [Unreleased]
### Changed
- cleaned up shutdown logic for outbound sender [#205](https://github.com/xmidt-org/caduceus/pull/205)
- added resetting queue depth and current workers gauges to outbound sender [#205](https://github.com/xmidt-org/caduceus/pull/205)
- removed queueEmpty variable from outbound sender [#209](https://github.com/xmidt-org/caduceus/pull/209)
- fixed outbound sender's long running dispatcher() goroutine to not exit when a cutoff occurs [#210](https://github.com/xmidt-org/caduceus/pull/210)
- register for specific OS signals [#211](https://github.com/xmidt-org/caduceus/pull/211)

## [v0.2.7]
- pared down logging, especially debugging logs [#196](https://github.com/xmidt-org/caduceus/pull/196)
Expand Down
10 changes: 3 additions & 7 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -220,16 +220,12 @@ func caduceus(arguments []string) int {
infoLog.Log(messageKey, "Caduceus is up and running!", "elapsedTime", time.Since(beginCaduceus))

signals := make(chan os.Signal, 10)
signal.Notify(signals)
signal.Notify(signals, os.Kill, os.Interrupt)
for exit := false; !exit; {
select {
case s := <-signals:
if s != os.Kill && s != os.Interrupt {
logger.Log(level.Key(), level.InfoValue(), logging.MessageKey(), "ignoring signal", "signal", s)
} else {
logger.Log(level.Key(), level.ErrorValue(), logging.MessageKey(), "exiting due to signal", "signal", s)
exit = true
}
logger.Log(level.Key(), level.ErrorValue(), logging.MessageKey(), "exiting due to signal", "signal", s)
exit = true
case <-done:
logger.Log(level.Key(), level.ErrorValue(), logging.MessageKey(), "one or more servers exited")
exit = true
Expand Down

0 comments on commit a43c582

Please sign in to comment.