mirror of
https://github.com/elyby/chrly.git
synced 2024-12-23 21:50:03 +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)
|
done := make(chan bool, 1)
|
||||||
go func() {
|
go func() {
|
||||||
logger.Info("Starting the server, HTTP on: :addr", wd.StringParam("addr", server.Addr))
|
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))
|
logger.Emergency("Error in main(): :err", wd.ErrParam(err))
|
||||||
close(done)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
close(done)
|
||||||
}()
|
}()
|
||||||
|
|
||||||
go func() {
|
go func() {
|
||||||
|
Loading…
Reference in New Issue
Block a user