Skip to content

Commit e3a93d0

Browse files
authored
add a default signal handler to have less boiler plate in the consumer repo (#9)
1 parent 3808437 commit e3a93d0

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

httputils/signals/signals.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import (
55
"net/http"
66
"os"
77
"os/signal"
8+
"syscall"
89
"time"
910

1011
log "github.com/sirupsen/logrus"
@@ -40,3 +41,7 @@ func ListenAndServeWithSignals(srv *http.Server, sc chan os.Signal, timeout int,
4041

4142
return srv.Shutdown(ctx)
4243
}
44+
45+
func ListenAndServeWithDefaultSignals(srv *http.Server, sc chan os.Signal, timeout int) error {
46+
return ListenAndServeWithSignals(srv, sc, timeout, os.Interrupt, syscall.SIGINT, syscall.SIGTERM)
47+
}

0 commit comments

Comments
 (0)