Skip to content
This repository has been archived by the owner on Nov 1, 2022. It is now read-only.

Wait for shutdown before returning from main() #1789

Merged
merged 1 commit into from
Mar 4, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 4 additions & 10 deletions cmd/fluxd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -222,15 +222,6 @@ func main() {
errc <- fmt.Errorf("%s", <-c)
}()

// This means we can return, and it will use the shutdown
// protocol.
defer func() {
// wait here until stopping.
logger.Log("exiting", <-errc)
close(shutdown)
shutdownWg.Wait()
}()

// Cluster component.
var clusterVersion string
var sshKeyRing ssh.KeyRing
Expand Down Expand Up @@ -546,5 +537,8 @@ func main() {
}()
}

// Fall off the end, into the waiting procedure.
// wait here until stopping.
logger.Log("exiting", <-errc)
close(shutdown)
shutdownWg.Wait()
}