Add option to disable Cache Warmer. Related to #2142

This commit is contained in:
Deluan 2023-02-06 09:50:04 -05:00
parent dad4949a6d
commit ee8f6447eb
2 changed files with 3 additions and 1 deletions

View File

@ -37,6 +37,7 @@ type configOptions struct {
EnableMediaFileCoverArt bool EnableMediaFileCoverArt bool
TranscodingCacheSize string TranscodingCacheSize string
ImageCacheSize string ImageCacheSize string
EnableArtworkPrecache bool
AutoImportPlaylists bool AutoImportPlaylists bool
PlaylistsPath string PlaylistsPath string
AutoTranscodeDownload bool AutoTranscodeDownload bool
@ -232,6 +233,7 @@ func init() {
viper.SetDefault("enabletranscodingconfig", false) viper.SetDefault("enabletranscodingconfig", false)
viper.SetDefault("transcodingcachesize", "100MB") viper.SetDefault("transcodingcachesize", "100MB")
viper.SetDefault("imagecachesize", "100MB") viper.SetDefault("imagecachesize", "100MB")
viper.SetDefault("enableartworkprecache", true)
viper.SetDefault("autoimportplaylists", true) viper.SetDefault("autoimportplaylists", true)
viper.SetDefault("playlistspath", consts.DefaultPlaylistsPath) viper.SetDefault("playlistspath", consts.DefaultPlaylistsPath)
viper.SetDefault("enabledownloads", true) viper.SetDefault("enabledownloads", true)

View File

@ -23,7 +23,7 @@ type CacheWarmer interface {
func NewCacheWarmer(artwork Artwork, cache cache.FileCache) CacheWarmer { func NewCacheWarmer(artwork Artwork, cache cache.FileCache) CacheWarmer {
// If image cache is disabled, return a NOOP implementation // If image cache is disabled, return a NOOP implementation
if conf.Server.ImageCacheSize == "0" { if conf.Server.ImageCacheSize == "0" || !conf.Server.EnableArtworkPrecache {
return &noopCacheWarmer{} return &noopCacheWarmer{}
} }