From 7ade74df968c370665ec8ab1c533b487097b6801 Mon Sep 17 00:00:00 2001 From: Deluan Date: Wed, 12 May 2021 14:08:38 -0400 Subject: [PATCH] Make ScanInterval=0 disable the periodic scan --- conf/configuration.go | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/conf/configuration.go b/conf/configuration.go index 726a1d92a..c0357b4d7 100644 --- a/conf/configuration.go +++ b/conf/configuration.go @@ -135,12 +135,16 @@ func Load() { } func validateScanSchedule() error { - if Server.ScanInterval != 0 { + if Server.ScanInterval != -1 { log.Warn("ScanInterval is DEPRECATED. Please use ScanSchedule. See docs at https://navidrome.org/docs/usage/configuration-options/") if Server.ScanSchedule != "@every 1m" { log.Error("You cannot specify both ScanInterval and ScanSchedule, ignoring ScanInterval") } else { - Server.ScanSchedule = fmt.Sprintf("@every %s", Server.ScanInterval) + if Server.ScanInterval == 0 { + Server.ScanSchedule = "" + } else { + Server.ScanSchedule = fmt.Sprintf("@every %s", Server.ScanInterval) + } log.Warn("Setting ScanSchedule", "schedule", Server.ScanSchedule) } } @@ -170,7 +174,7 @@ func init() { viper.SetDefault("address", "0.0.0.0") viper.SetDefault("port", 4533) viper.SetDefault("sessiontimeout", consts.DefaultSessionTimeout) - viper.SetDefault("scaninterval", 0) + viper.SetDefault("scaninterval", -1) viper.SetDefault("scanschedule", "@every 1m") viper.SetDefault("baseurl", "") viper.SetDefault("uiloginbackgroundurl", consts.DefaultUILoginBackgroundURL)