1
0
Эх сурвалжийг харах

lib/config: Disable cacheIgnoredFiles, new default is disabled

Jakob Borg 9 жил өмнө
parent
commit
a4f0b85462

+ 11 - 1
lib/config/config.go

@@ -21,7 +21,7 @@ import (
 
 const (
 	OldestHandledVersion = 10
-	CurrentVersion       = 12
+	CurrentVersion       = 13
 	MaxRescanIntervalS   = 365 * 24 * 60 * 60
 )
 
@@ -182,6 +182,9 @@ func (cfg *Configuration) prepare(myID protocol.DeviceID) {
 	if cfg.Version == 11 {
 		convertV11V12(cfg)
 	}
+	if cfg.Version == 12 {
+		convertV12V13(cfg)
+	}
 
 	// Build a list of available devices
 	existingDevices := make(map[protocol.DeviceID]bool)
@@ -235,6 +238,13 @@ func (cfg *Configuration) prepare(myID protocol.DeviceID) {
 	}
 }
 
+func convertV12V13(cfg *Configuration) {
+	// Not using the ignore cache is the new default. Disable it on existing
+	// configurations.
+	cfg.Options.CacheIgnoredFiles = false
+	cfg.Version = 13
+}
+
 func convertV11V12(cfg *Configuration) {
 	// Change listen address schema
 	for i, addr := range cfg.Options.ListenAddress {

+ 2 - 2
lib/config/config_test.go

@@ -51,7 +51,7 @@ func TestDefaultValues(t *testing.T) {
 		RestartOnWakeup:         true,
 		AutoUpgradeIntervalH:    12,
 		KeepTemporariesH:        24,
-		CacheIgnoredFiles:       true,
+		CacheIgnoredFiles:       false,
 		ProgressUpdateIntervalS: 5,
 		SymlinksEnabled:         true,
 		LimitBandwidthInLan:     false,
@@ -180,7 +180,7 @@ func TestOverriddenValues(t *testing.T) {
 		RestartOnWakeup:         false,
 		AutoUpgradeIntervalH:    24,
 		KeepTemporariesH:        48,
-		CacheIgnoredFiles:       false,
+		CacheIgnoredFiles:       true,
 		ProgressUpdateIntervalS: 10,
 		SymlinksEnabled:         false,
 		LimitBandwidthInLan:     true,

+ 1 - 1
lib/config/optionsconfiguration.go

@@ -32,7 +32,7 @@ type OptionsConfiguration struct {
 	RestartOnWakeup         bool     `xml:"restartOnWakeup" json:"restartOnWakeup" default:"true"`
 	AutoUpgradeIntervalH    int      `xml:"autoUpgradeIntervalH" json:"autoUpgradeIntervalH" default:"12"` // 0 for off
 	KeepTemporariesH        int      `xml:"keepTemporariesH" json:"keepTemporariesH" default:"24"`         // 0 for off
-	CacheIgnoredFiles       bool     `xml:"cacheIgnoredFiles" json:"cacheIgnoredFiles" default:"true"`
+	CacheIgnoredFiles       bool     `xml:"cacheIgnoredFiles" json:"cacheIgnoredFiles" default:"false"`
 	ProgressUpdateIntervalS int      `xml:"progressUpdateIntervalS" json:"progressUpdateIntervalS" default:"5"`
 	SymlinksEnabled         bool     `xml:"symlinksEnabled" json:"symlinksEnabled" default:"true"`
 	LimitBandwidthInLan     bool     `xml:"limitBandwidthInLan" json:"limitBandwidthInLan" default:"false"`

+ 3 - 3
lib/config/testdata/overridenvalues.xml

@@ -1,6 +1,6 @@
-<configuration version="11">
+<configuration version="13">
     <options>
-        <listenAddress>:23000</listenAddress>
+        <listenAddress>tcp://:23000</listenAddress>
         <allowDelete>false</allowDelete>
         <globalAnnounceServer>udp4://syncthing.nym.se:22026</globalAnnounceServer>
         <globalAnnounceEnabled>false</globalAnnounceEnabled>
@@ -24,7 +24,7 @@
         <restartOnWakeup>false</restartOnWakeup>
         <autoUpgradeIntervalH>24</autoUpgradeIntervalH>
         <keepTemporariesH>48</keepTemporariesH>
-        <cacheIgnoredFiles>false</cacheIgnoredFiles>
+        <cacheIgnoredFiles>true</cacheIgnoredFiles>
         <progressUpdateIntervalS>10</progressUpdateIntervalS>
         <symlinksEnabled>false</symlinksEnabled>
         <limitBandwidthInLan>true</limitBandwidthInLan>

+ 14 - 0
lib/config/testdata/v13.xml

@@ -0,0 +1,14 @@
+<configuration version="13">
+    <folder id="test" path="testdata" ro="true" ignorePerms="false" rescanIntervalS="600" autoNormalize="true">
+        <device id="AIR6LPZ-7K4PTTV-UXQSMUU-CPQ5YWH-OEDFIIQ-JUG777G-2YQXXR5-YD6AWQR"></device>
+        <device id="P56IOI7-MZJNU2Y-IQGDREY-DM2MGTI-MGL3BXN-PQ6W5BM-TBBZ4TJ-XZWICQ2"></device>
+        <minDiskFreePct>1</minDiskFreePct>
+        <maxConflicts>-1</maxConflicts>
+    </folder>
+    <device id="AIR6LPZ-7K4PTTV-UXQSMUU-CPQ5YWH-OEDFIIQ-JUG777G-2YQXXR5-YD6AWQR" name="node one" compression="metadata">
+        <address>tcp://a</address>
+    </device>
+    <device id="P56IOI7-MZJNU2Y-IQGDREY-DM2MGTI-MGL3BXN-PQ6W5BM-TBBZ4TJ-XZWICQ2" name="node two" compression="metadata">
+        <address>tcp://b</address>
+    </device>
+</configuration>