mirror of
https://github.com/elyby/chrly.git
synced 2024-12-23 13:40:11 +05:30
Handling correctly closing the server
This commit is contained in:
parent
cc4cd2874c
commit
0be85b356b
@ -23,10 +23,11 @@ func StartServer(server *http.Server, logger slf.Logger) {
|
||||
done := make(chan bool, 1)
|
||||
go func() {
|
||||
logger.Info("Starting the server, HTTP on: :addr", wd.StringParam("addr", server.Addr))
|
||||
if err := server.ListenAndServe(); err != nil {
|
||||
if err := server.ListenAndServe(); err != nil && err != http.ErrServerClosed {
|
||||
logger.Emergency("Error in main(): :err", wd.ErrParam(err))
|
||||
close(done)
|
||||
}
|
||||
|
||||
close(done)
|
||||
}()
|
||||
|
||||
go func() {
|
||||
|
Loading…
Reference in New Issue
Block a user