server now waits on teardown sites
Dieser Commit ist enthalten in:
Ursprung
818560df17
Commit
9ac6b96eee
11
http.go
11
http.go
|
@ -188,11 +188,12 @@ func (s *Server) Use(m ...gin.HandlerFunc) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Stop Shuts the Server down
|
// Stop Shuts the Server down
|
||||||
func (s *Server) Stop(ctx context.Context) {
|
func (server *Server) Stop(ctx context.Context) {
|
||||||
log.Info().Err(s.http.Shutdown(ctx)).Msg("Server Shut down.")
|
log.Info().Err(server.http.Shutdown(ctx)).Msg("Server Shut down.")
|
||||||
for _, s := range s.sites {
|
for _, s := range server.sites {
|
||||||
if ts, ok := s.(TeardownSite); ok {
|
if ts, ok := s.(TeardownSite); ok {
|
||||||
ts.Teardown()
|
ts.Teardown()
|
||||||
|
server.routines.Done()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -304,6 +305,10 @@ func (s *Server) Setup() {
|
||||||
log.Error().Err(err).Msgf("Failed to setup site with config %s", cfg)
|
log.Error().Err(err).Msgf("Failed to setup site with config %s", cfg)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if _, ok := site.(TeardownSite); ok {
|
||||||
|
log.Trace().Msg("Added teardownsite to the sg")
|
||||||
|
s.routines.Add(1)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
for _, m := range s.advmiddleware {
|
for _, m := range s.advmiddleware {
|
||||||
if psm, ok := m.(middleware.PostSetupMiddleware); ok {
|
if psm, ok := m.(middleware.PostSetupMiddleware); ok {
|
||||||
|
|
Laden…
In neuem Issue referenzieren