Browse Source

Merge pull request #2156 from calmh/stuckatzero

Don't get stuck at "Syncing 0%" when adding a new folder
Audrius Butkevicius 10 năm trước cách đây
mục cha
commit
7a9bb65e03

+ 1 - 0
gui/syncthing/core/syncthingController.js

@@ -1079,6 +1079,7 @@ angular.module('syncthing.core')
                 selectedDevices: {},
                 rescanIntervalS: 60,
                 minDiskFreePct: 1,
+                order: "random",
                 fileVersioningSelector: "none",
                 trashcanClean: 0,
                 simpleKeep: 5,

Những thai đổi đã bị hủy bỏ vì nó quá lớn
+ 1 - 1
lib/auto/gui.files.go


+ 0 - 6
lib/config/config.go

@@ -404,12 +404,6 @@ func (cfg *Configuration) prepare(myID protocol.DeviceID) {
 		cfg.Folders[i].Devices = ensureDevicePresent(cfg.Folders[i].Devices, myID)
 		cfg.Folders[i].Devices = ensureExistingDevices(cfg.Folders[i].Devices, existingDevices)
 		cfg.Folders[i].Devices = ensureNoDuplicates(cfg.Folders[i].Devices)
-		if cfg.Folders[i].Copiers == 0 {
-			cfg.Folders[i].Copiers = 1
-		}
-		if cfg.Folders[i].Pullers == 0 {
-			cfg.Folders[i].Pullers = 16
-		}
 		sort.Sort(FolderDeviceConfigurationList(cfg.Folders[i].Devices))
 	}
 

+ 2 - 2
lib/config/config_test.go

@@ -89,8 +89,8 @@ func TestDeviceConfig(t *testing.T) {
 				Devices:         []FolderDeviceConfiguration{{DeviceID: device1}, {DeviceID: device4}},
 				ReadOnly:        true,
 				RescanIntervalS: 600,
-				Copiers:         1,
-				Pullers:         16,
+				Copiers:         0,
+				Pullers:         0,
 				Hashers:         0,
 				AutoNormalize:   true,
 				MinDiskFreePct:  1,

+ 15 - 1
lib/model/rwfolder.go

@@ -66,6 +66,11 @@ const (
 	dbUpdateShortcutFile
 )
 
+const (
+	defaultCopiers = 1
+	defaultPullers = 16
+)
+
 type dbUpdateJob struct {
 	file    protocol.FileInfo
 	jobType int
@@ -102,7 +107,7 @@ type rwFolder struct {
 }
 
 func newRWFolder(m *Model, shortID uint64, cfg config.FolderConfiguration) *rwFolder {
-	return &rwFolder{
+	p := &rwFolder{
 		stateTracker: stateTracker{
 			folder: cfg.ID,
 			mut:    sync.NewMutex(),
@@ -131,6 +136,15 @@ func newRWFolder(m *Model, shortID uint64, cfg config.FolderConfiguration) *rwFo
 
 		errorsMut: sync.NewMutex(),
 	}
+
+	if p.copiers == 0 {
+		p.copiers = defaultCopiers
+	}
+	if p.pullers == 0 {
+		p.pullers = defaultPullers
+	}
+
+	return p
 }
 
 // Helper function to check whether either the ignorePerm flag has been

Một số tệp đã không được hiển thị bởi vì quá nhiều tập tin thay đổi trong này khác