mirror of
https://github.com/mxpv/podsync.git
synced 2024-05-11 05:55:04 +00:00
Fix shutdown server context cancel error
This commit is contained in:
@ -190,8 +190,12 @@ func main() {
|
||||
group.Go(func() error {
|
||||
// Shutdown web server
|
||||
defer func() {
|
||||
ctxShutDown, cancel := context.WithTimeout(context.Background(), 5*time.Second)
|
||||
defer func() {
|
||||
cancel()
|
||||
}()
|
||||
log.Info("shutting down web server")
|
||||
if err := srv.Shutdown(ctx); err != nil {
|
||||
if err := srv.Shutdown(ctxShutDown); err != nil {
|
||||
log.WithError(err).Error("server shutdown failed")
|
||||
}
|
||||
}()
|
||||
|
Reference in New Issue
Block a user