🎧 Your Personal Streaming Service
Go airsonicmadsonicmedia-servermusicmusic-servernavidromeopensubsonicraspberry-piself-hostedstreamerstreaming-apistreaming-audiosubsonicsubsonic-server
New dev options to control getCoverArt throttling
Deluanc46a2a5f5fdd
diff --git a/conf/configuration.go b/conf/configuration.goindex cdf5cbeb9..b323de03c 100644--- a/conf/configuration.go+++ b/conf/configuration.go@@ -4,12 +4,14 @@ import ("fmt""os""path/filepath"+ "runtime""strings""time""github.com/kr/pretty""github.com/navidrome/navidrome/consts""github.com/navidrome/navidrome/log"+ "github.com/navidrome/navidrome/utils/number""github.com/robfig/cron/v3""github.com/spf13/viper")@@ -73,15 +75,18 @@ type configOptions struct {DefaultDownsamplingFormat string// DevFlags. These are used to enable/disable debugging and incomplete features- DevLogSourceLine bool- DevLogLevels map[string]string- DevAutoCreateAdminPassword string- DevAutoLoginUsername string- DevActivityPanel bool- DevEnableShare bool- DevSidebarPlaylists bool- DevEnableBufferedScrobble bool- DevShowArtistPage bool+ DevLogSourceLine bool+ DevLogLevels map[string]string+ DevAutoCreateAdminPassword string+ DevAutoLoginUsername string+ DevActivityPanel bool+ DevEnableShare bool+ DevSidebarPlaylists bool+ DevEnableBufferedScrobble bool+ DevShowArtistPage bool+ DevArtworkMaxRequests int+ DevArtworkThrottleBacklogLimit int+ DevArtworkThrottleBacklogTimeout time.Duration}type scannerOptions struct {@@ -284,6 +289,9 @@ func init() {viper.SetDefault("devenablebufferedscrobble", true)viper.SetDefault("devsidebarplaylists", true)viper.SetDefault("devshowartistpage", true)+ viper.SetDefault("devartworkmaxrequests", number.Max(2, runtime.NumCPU()))+ viper.SetDefault("devartworkthrottlebackloglimit", consts.RequestThrottleBacklogLimit)+ viper.SetDefault("devartworkthrottlebacklogtimeout", consts.RequestThrottleBacklogTimeout)}func InitConfig(cfgFile string) {diff --git a/server/subsonic/api.go b/server/subsonic/api.goindex 9ab2c5f0b..b2c59316c 100644--- a/server/subsonic/api.go+++ b/server/subsonic/api.go@@ -6,11 +6,10 @@ import ("errors""fmt""net/http"- "runtime""github.com/go-chi/chi/v5""github.com/go-chi/chi/v5/middleware"- "github.com/navidrome/navidrome/consts"+ "github.com/navidrome/navidrome/conf""github.com/navidrome/navidrome/core""github.com/navidrome/navidrome/core/artwork""github.com/navidrome/navidrome/core/scrobbler"@@ -20,7 +19,6 @@ import ("github.com/navidrome/navidrome/server/events""github.com/navidrome/navidrome/server/subsonic/responses""github.com/navidrome/navidrome/utils"- "github.com/navidrome/navidrome/utils/number")const Version = "1.16.1"@@ -138,13 +136,18 @@ func (api *Router) routes() http.Handler {h(r, "startScan", api.StartScan)})r.Group(func(r chi.Router) {- // configure request throttling- maxRequests := number.Max(2, runtime.NumCPU())- r.Use(middleware.ThrottleBacklog(maxRequests, consts.RequestThrottleBacklogLimit, consts.RequestThrottleBacklogTimeout))hr(r, "getAvatar", api.GetAvatar)- hr(r, "getCoverArt", api.GetCoverArt)h(r, "getLyrics", api.GetLyrics)})+ r.Group(func(r chi.Router) {+ // configure request throttling+ if conf.Server.DevArtworkMaxRequests > 0 {+ maxRequests := conf.Server.DevArtworkMaxRequests+ r.Use(middleware.ThrottleBacklog(maxRequests, conf.Server.DevArtworkThrottleBacklogLimit,+ conf.Server.DevArtworkThrottleBacklogTimeout))+ }+ hr(r, "getCoverArt", api.GetCoverArt)+ })r.Group(func(r chi.Router) {r.Use(getPlayer(api.players))hr(r, "stream", api.Stream)