From 694be54428a77dcb1100aead704f63656ef4dde4 Mon Sep 17 00:00:00 2001 From: Deluan Date: Mon, 20 Apr 2020 12:17:01 -0400 Subject: [PATCH] Replace math.Max with utils.MaxInt --- server/server.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/server/server.go b/server/server.go index 0c98a8555..990caad73 100644 --- a/server/server.go +++ b/server/server.go @@ -1,7 +1,6 @@ package server import ( - "math" "net/http" "os" "path" @@ -14,6 +13,7 @@ import ( "github.com/deluan/navidrome/log" "github.com/deluan/navidrome/model" "github.com/deluan/navidrome/scanner" + "github.com/deluan/navidrome/utils" "github.com/go-chi/chi" "github.com/go-chi/chi/middleware" "github.com/go-chi/cors" @@ -65,8 +65,8 @@ func (a *Server) initRoutes() { r.Use(InjectLogger) // configure request throttling - maxRequests := math.Max(2, float64(runtime.NumCPU())) - r.Use(middleware.ThrottleBacklog(int(maxRequests), consts.RequestThrottleBacklogLimit, consts.RequestThrottleBacklogTimeout)) + maxRequests := utils.MaxInt(2, runtime.NumCPU()) + r.Use(middleware.ThrottleBacklog(maxRequests, consts.RequestThrottleBacklogLimit, consts.RequestThrottleBacklogTimeout)) indexHtml := path.Join(conf.Server.BaseURL, consts.URLPathUI, "index.html") r.Get("/*", func(w http.ResponseWriter, r *http.Request) {