Add a server context that gets canceled when a server is deleted

This commit is contained in:
Dane Everitt
2020-12-25 11:21:09 -08:00
parent f7f5623c71
commit c0523df696
9 changed files with 93 additions and 104 deletions

View File

@@ -356,6 +356,12 @@ func rootCmdRun(*cobra.Command, []string) {
if err := s.ListenAndServe(); err != nil {
log.WithField("error", err).Fatal("failed to configure HTTP server")
}
// Cancel the context on all of the running servers at this point, even though the
// program is just shutting down.
for _, s := range server.GetServers().All() {
s.CtxCancel()
}
}
// Execute calls cobra to handle cli commands