Explorar el Código

graceful stop

not really tested
boyska hace 6 años
padre
commit
c8e002b5c4
Se han modificado 1 ficheros con 4 adiciones y 1 borrados
  1. 4 1
      cmd/megauploader/main.go

+ 4 - 1
cmd/megauploader/main.go

@@ -5,6 +5,9 @@ import (
 	"fmt"
 	"net/http"
 	"os"
+	"time"
+
+	"github.com/tylerb/graceful"
 
 	"git.lattuga.net/boyska/megauploader"
 )
@@ -34,5 +37,5 @@ func main() {
 
 	mu := megauploader.MegaUploader{Conf: cfg}
 	mu.SetupRoutes()
-	http.ListenAndServe(*addr, nil)
+	graceful.Run(*addr, 15*time.Second, http.DefaultServeMux)
 }