Merge pull request #7704 from hashicorp/b-agent-shutdown-order

agent: shutdown agent http server last
This commit is contained in:
Mahmood Ali 2020-04-20 10:37:26 -04:00 committed by GitHub
commit 5b42796f1e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -640,10 +640,12 @@ func (c *Command) Run(args []string) int {
logGate.Flush()
return 1
}
defer c.agent.Shutdown()
// Shutdown the HTTP server at the end
defer func() {
c.agent.Shutdown()
// Shutdown the http server at the end, to ease debugging if
// the agent takes long to shutdown
if c.httpServer != nil {
c.httpServer.Shutdown()
}