diff --git a/internal/skeleton/main.go b/internal/skeleton/main.go index 52d7037..eb61d1f 100644 --- a/internal/skeleton/main.go +++ b/internal/skeleton/main.go @@ -9,6 +9,7 @@ import ( "github.com/colegion/goal/internal/skeleton/assets/handlers" "github.com/colegion/goal/internal/skeleton/routes" + "github.com/colegion/contrib/servers/grace" c "github.com/colegion/goal/config" ) @@ -32,7 +33,7 @@ func main() { // Starting the server. log.Printf(`Listening on "%s".`, s.Addr) - log.Fatal(serve(s)) + log.Fatal(grace.Serve(s)) } func init() { diff --git a/internal/skeleton/nix.go b/internal/skeleton/nix.go deleted file mode 100644 index 16d7a2c..0000000 --- a/internal/skeleton/nix.go +++ /dev/null @@ -1,18 +0,0 @@ -// When not on windows using graceful restarts and shutdowns. -// -// +build !windows - -package main - -import ( - "net/http" - - "github.com/facebookgo/grace/gracehttp" -) - -// serve is a wrapper on gracehttp.Serve. As opposed to -// the standard http library, this one may be terminated -// and/or restarted without dropping any connections. -func serve(s *http.Server) error { - return gracehttp.Serve(s) -} diff --git a/internal/skeleton/win.go b/internal/skeleton/win.go deleted file mode 100644 index 46de046..0000000 --- a/internal/skeleton/win.go +++ /dev/null @@ -1,15 +0,0 @@ -// Graceful restarts and shutdowns are not supported -// on windows, so using usual http.Serve instead. -// -// +build windows - -package main - -import ( - "net/http" -) - -// serve is a wrapper on standard http.Serve method. -func serve(s *http.Server) error { - return s.ListenAndServe() -}