refactor(transcoding): rename EnableTranscodingCancellation to Transcoding.EnableCancellation (#5523)
Move the option into the nested Transcoding config group alongside the limit knobs it interacts with, so all transcoding-related settings live together. The old top-level name is still honored via the existing mapDeprecatedOption / logDeprecatedOptions plumbing, which forwards the value to the new key and logs a deprecation warning at startup. The old struct field is removed (the new field is the single source of truth); the deprecated default is removed so viper.IsSet correctly distinguishes "user set the legacy option" from "no one set it."
This commit is contained in:
parent
945d0ba1e2
commit
823d851b75
2 changed files with 7 additions and 5 deletions
|
|
@ -47,7 +47,6 @@ type configOptions struct {
|
||||||
UIWelcomeMessage string
|
UIWelcomeMessage string
|
||||||
MaxSidebarPlaylists int
|
MaxSidebarPlaylists int
|
||||||
EnableTranscodingConfig bool
|
EnableTranscodingConfig bool
|
||||||
EnableTranscodingCancellation bool
|
|
||||||
EnableDownloads bool
|
EnableDownloads bool
|
||||||
EnableExternalServices bool
|
EnableExternalServices bool
|
||||||
EnableM3UExternalAlbumArt bool
|
EnableM3UExternalAlbumArt bool
|
||||||
|
|
@ -169,6 +168,7 @@ type scannerOptions struct {
|
||||||
type transcodingOptions struct {
|
type transcodingOptions struct {
|
||||||
MaxConcurrent int
|
MaxConcurrent int
|
||||||
MaxConcurrentPerUser int
|
MaxConcurrentPerUser int
|
||||||
|
EnableCancellation bool
|
||||||
}
|
}
|
||||||
|
|
||||||
type subsonicOptions struct {
|
type subsonicOptions struct {
|
||||||
|
|
@ -330,6 +330,7 @@ func Load(noConfigDump bool) {
|
||||||
mapDeprecatedOption("HTTPSecurityHeaders.CustomFrameOptionsValue", "HTTPHeaders.FrameOptions")
|
mapDeprecatedOption("HTTPSecurityHeaders.CustomFrameOptionsValue", "HTTPHeaders.FrameOptions")
|
||||||
mapDeprecatedOption("CoverJpegQuality", "CoverArtQuality")
|
mapDeprecatedOption("CoverJpegQuality", "CoverArtQuality")
|
||||||
mapDeprecatedOption("SimilarSongsMatchThreshold", "Matcher.FuzzyThreshold")
|
mapDeprecatedOption("SimilarSongsMatchThreshold", "Matcher.FuzzyThreshold")
|
||||||
|
mapDeprecatedOption("EnableTranscodingCancellation", "Transcoding.EnableCancellation")
|
||||||
|
|
||||||
err := viper.Unmarshal(&Server, viper.DecodeHook(
|
err := viper.Unmarshal(&Server, viper.DecodeHook(
|
||||||
mapstructure.ComposeDecodeHookFunc(
|
mapstructure.ComposeDecodeHookFunc(
|
||||||
|
|
@ -455,6 +456,7 @@ func Load(noConfigDump bool) {
|
||||||
logDeprecatedOptions("HTTPSecurityHeaders.CustomFrameOptionsValue", "HTTPHeaders.FrameOptions")
|
logDeprecatedOptions("HTTPSecurityHeaders.CustomFrameOptionsValue", "HTTPHeaders.FrameOptions")
|
||||||
logDeprecatedOptions("CoverJpegQuality", "CoverArtQuality")
|
logDeprecatedOptions("CoverJpegQuality", "CoverArtQuality")
|
||||||
logDeprecatedOptions("SimilarSongsMatchThreshold", "Matcher.FuzzyThreshold")
|
logDeprecatedOptions("SimilarSongsMatchThreshold", "Matcher.FuzzyThreshold")
|
||||||
|
logDeprecatedOptions("EnableTranscodingCancellation", "Transcoding.EnableCancellation")
|
||||||
|
|
||||||
// Removed options
|
// Removed options
|
||||||
logRemovedOptions("Spotify.ID", "Spotify.Secret")
|
logRemovedOptions("Spotify.ID", "Spotify.Secret")
|
||||||
|
|
@ -743,7 +745,6 @@ func setViperDefaults() {
|
||||||
viper.SetDefault("uiwelcomemessage", "")
|
viper.SetDefault("uiwelcomemessage", "")
|
||||||
viper.SetDefault("maxsidebarplaylists", consts.DefaultMaxSidebarPlaylists)
|
viper.SetDefault("maxsidebarplaylists", consts.DefaultMaxSidebarPlaylists)
|
||||||
viper.SetDefault("enabletranscodingconfig", false)
|
viper.SetDefault("enabletranscodingconfig", false)
|
||||||
viper.SetDefault("enabletranscodingcancellation", false)
|
|
||||||
viper.SetDefault("transcodingcachesize", "100MB")
|
viper.SetDefault("transcodingcachesize", "100MB")
|
||||||
viper.SetDefault("imagecachesize", "100MB")
|
viper.SetDefault("imagecachesize", "100MB")
|
||||||
viper.SetDefault("albumplaycountmode", consts.AlbumPlayCountModeAbsolute)
|
viper.SetDefault("albumplaycountmode", consts.AlbumPlayCountModeAbsolute)
|
||||||
|
|
@ -830,6 +831,7 @@ func setViperDefaults() {
|
||||||
viper.SetDefault("subsonic.minimalclients", "SubMusic")
|
viper.SetDefault("subsonic.minimalclients", "SubMusic")
|
||||||
viper.SetDefault("transcoding.maxconcurrent", 0)
|
viper.SetDefault("transcoding.maxconcurrent", 0)
|
||||||
viper.SetDefault("transcoding.maxconcurrentperuser", 0)
|
viper.SetDefault("transcoding.maxconcurrentperuser", 0)
|
||||||
|
viper.SetDefault("transcoding.enablecancellation", false)
|
||||||
viper.SetDefault("agents", "deezer,lastfm,listenbrainz")
|
viper.SetDefault("agents", "deezer,lastfm,listenbrainz")
|
||||||
viper.SetDefault("lastfm.enabled", true)
|
viper.SetDefault("lastfm.enabled", true)
|
||||||
viper.SetDefault("lastfm.language", consts.DefaultInfoLanguage)
|
viper.SetDefault("lastfm.language", consts.DefaultInfoLanguage)
|
||||||
|
|
|
||||||
|
|
@ -248,10 +248,10 @@ func NewTranscodingCache() TranscodingCache {
|
||||||
// the DoS the limiter is meant to prevent.
|
// the DoS the limiter is meant to prevent.
|
||||||
//
|
//
|
||||||
// When the limiter is disabled, preserve the legacy behavior
|
// When the limiter is disabled, preserve the legacy behavior
|
||||||
// governed by EnableTranscodingCancellation so this PR does not
|
// governed by Transcoding.EnableCancellation so unchanged configs
|
||||||
// change observable behavior for operators who have not opted in.
|
// keep their previous observable behavior.
|
||||||
var transcodingCtx context.Context
|
var transcodingCtx context.Context
|
||||||
if job.ms.limiter.Enabled() || conf.Server.EnableTranscodingCancellation {
|
if job.ms.limiter.Enabled() || conf.Server.Transcoding.EnableCancellation {
|
||||||
transcodingCtx = ctx
|
transcodingCtx = ctx
|
||||||
} else {
|
} else {
|
||||||
transcodingCtx = request.AddValues(context.Background(), ctx)
|
transcodingCtx = request.AddValues(context.Background(), ctx)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue