mirror of
https://github.com/giongto35/cloud-game.git
synced 2026-07-21 00:59:22 +00:00
Skip normal ErrServerClosed errors
This commit is contained in:
parent
0f54e0fb15
commit
98ca6e7ace
2 changed files with 12 additions and 2 deletions
|
|
@ -63,12 +63,22 @@ func (sm *ServerMonitoring) Run() error {
|
|||
glog.Infof("[%v] Prometheus metric is enabled at %v", sm.tag, srv.Addr+metricPath)
|
||||
monitoringServerMux.Handle(metricPath, promhttp.Handler())
|
||||
}
|
||||
return srv.ListenAndServe()
|
||||
|
||||
err := srv.ListenAndServe()
|
||||
if err == http.ErrServerClosed {
|
||||
glog.Infof("[%v] The main HTTP server has been closed", sm.tag)
|
||||
return nil
|
||||
}
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (sm *ServerMonitoring) Shutdown(ctx context.Context) error {
|
||||
if sm.server == nil {
|
||||
return nil
|
||||
}
|
||||
|
||||
glog.Infof("[%v] Shutting down monitoring server", sm.tag)
|
||||
return sm.server.Shutdown(ctx)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -58,7 +58,7 @@ func (wrk *Worker) startModules() {
|
|||
return
|
||||
}
|
||||
if err := s.Run(); err != nil {
|
||||
glog.Errorf("failed start server")
|
||||
glog.Errorf("failed start server: [%v]", err)
|
||||
}
|
||||
}()
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue