Browse Source

cmd/syncthing: Correct auto upgrade criteria (fixes #6701) (#6702)

Jakob Borg 5 years ago
parent
commit
bfc9478965
2 changed files with 5 additions and 1 deletions
  1. 1 1
      cmd/syncthing/main.go
  2. 4 0
      lib/config/optionsconfiguration.go

+ 1 - 1
cmd/syncthing/main.go

@@ -842,7 +842,7 @@ func shouldUpgrade(cfg config.Wrapper, runtimeOptions RuntimeOptions) bool {
 	if upgrade.DisabledByCompilation {
 		return false
 	}
-	if opts := cfg.Options(); opts.AutoUpgradeIntervalH < 0 {
+	if !cfg.Options().ShouldAutoUpgrade() {
 		return false
 	}
 	if runtimeOptions.NoUpgrade {

+ 4 - 0
lib/config/optionsconfiguration.go

@@ -200,3 +200,7 @@ func (opts OptionsConfiguration) MaxConcurrentIncomingRequestKiB() int {
 	// Roll with it.
 	return opts.RawMaxCIRequestKiB
 }
+
+func (opts OptionsConfiguration) ShouldAutoUpgrade() bool {
+	return opts.AutoUpgradeIntervalH > 0
+}