mirror of
https://github.com/caddyserver/caddy.git
synced 2025-01-14 14:56:27 +03:00
caddyhttp: Log shutdown errors, don't return (fix #4908)
This commit is contained in:
parent
a379fa4c6c
commit
0bebea0d4c
1 changed files with 10 additions and 8 deletions
|
@ -415,19 +415,21 @@ func (app *App) Stop() error {
|
||||||
ctx, cancel = context.WithTimeout(ctx, time.Duration(app.GracePeriod))
|
ctx, cancel = context.WithTimeout(ctx, time.Duration(app.GracePeriod))
|
||||||
defer cancel()
|
defer cancel()
|
||||||
}
|
}
|
||||||
for _, s := range app.servers {
|
for i, s := range app.servers {
|
||||||
err := s.Shutdown(ctx)
|
if err := s.Shutdown(ctx); err != nil {
|
||||||
if err != nil {
|
app.logger.Error("server shutdown",
|
||||||
return err
|
zap.Error(err),
|
||||||
|
zap.Int("index", i))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, s := range app.h3servers {
|
for i, s := range app.h3servers {
|
||||||
// TODO: CloseGracefully, once implemented upstream
|
// TODO: CloseGracefully, once implemented upstream
|
||||||
// (see https://github.com/lucas-clemente/quic-go/issues/2103)
|
// (see https://github.com/lucas-clemente/quic-go/issues/2103)
|
||||||
err := s.Close()
|
if err := s.Close(); err != nil {
|
||||||
if err != nil {
|
app.logger.Error("HTTP/3 server shutdown",
|
||||||
return err
|
zap.Error(err),
|
||||||
|
zap.Int("index", i))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
|
|
Loading…
Reference in a new issue