Skip to content

Commit

Permalink
Move cleanup to exit handler
Browse files Browse the repository at this point in the history
  • Loading branch information
thrau committed May 19, 2020
1 parent dcd6ece commit e00fec2
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions cmd/telemd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ func main() {
if err != nil {
log.Fatal("error initializing node info", err)
}
defer commandServer.RemoveNodeInfo()

telemetryReporter := telemd.NewRedisReporter(daemon, redisClient)

Expand All @@ -48,15 +47,14 @@ func main() {
<-sigs
log.Println("stopping daemon")
commandServer.Stop()
commandServer.RemoveNodeInfo()
telemetryReporter.Stop()
daemon.Stop()
}()

go commandServer.Run()
go telemetryReporter.Run()

defer redisClient.Close()

log.Println("running daemon")
daemon.Run() // blocks until everything has shut down after daemon.Stop()
log.Println("exiting")
Expand Down

0 comments on commit e00fec2

Please sign in to comment.