We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 132bc44 commit 538b32dCopy full SHA for 538b32d
internal/web/server.go
@@ -1,6 +1,7 @@
1
package web
2
3
import (
4
+ "context"
5
"crypto/tls"
6
"fmt"
7
"io"
@@ -303,7 +304,12 @@ func (ws *WebServer) Start() {
303
304
305
func (ws *WebServer) Stop() {
306
log.Println("Stopping webserver...")
- if err := ws.server.Shutdown(nil); err != nil {
307
+
308
+ // If the server did not stop within 15 seconds, forcefully close it
309
+ ctx, cancel := context.WithTimeout(context.Background(), 15*time.Second)
310
+ defer cancel()
311
312
+ if err := ws.server.Shutdown(ctx); err != nil {
313
log.Fatal("Error while stopping webserver: ", err)
314
}
315
0 commit comments