mirror of
https://github.com/octoleo/syncthing.git
synced 2024-11-14 01:04:14 +00:00
Don't get stuck at "Syncing 0%" when adding a new folder
The number of copiers and pullers is set to default at config loading time, but the new folder configuration doesn't pass through config loading so we start up with 0 copiers and 0 pullers and hence get stuck. I moved the default handling to the puller itself instead. I think this way is also cleaner as we get to keep the 0 in the config and the puller gets to decide the defaults on it's own.
This commit is contained in:
parent
ae5079f7b4
commit
a5345ac71e
@ -1079,6 +1079,7 @@ angular.module('syncthing.core')
|
|||||||
selectedDevices: {},
|
selectedDevices: {},
|
||||||
rescanIntervalS: 60,
|
rescanIntervalS: 60,
|
||||||
minDiskFreePct: 1,
|
minDiskFreePct: 1,
|
||||||
|
order: "random",
|
||||||
fileVersioningSelector: "none",
|
fileVersioningSelector: "none",
|
||||||
trashcanClean: 0,
|
trashcanClean: 0,
|
||||||
simpleKeep: 5,
|
simpleKeep: 5,
|
||||||
|
File diff suppressed because one or more lines are too long
@ -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 = ensureDevicePresent(cfg.Folders[i].Devices, myID)
|
||||||
cfg.Folders[i].Devices = ensureExistingDevices(cfg.Folders[i].Devices, existingDevices)
|
cfg.Folders[i].Devices = ensureExistingDevices(cfg.Folders[i].Devices, existingDevices)
|
||||||
cfg.Folders[i].Devices = ensureNoDuplicates(cfg.Folders[i].Devices)
|
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))
|
sort.Sort(FolderDeviceConfigurationList(cfg.Folders[i].Devices))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -89,8 +89,8 @@ func TestDeviceConfig(t *testing.T) {
|
|||||||
Devices: []FolderDeviceConfiguration{{DeviceID: device1}, {DeviceID: device4}},
|
Devices: []FolderDeviceConfiguration{{DeviceID: device1}, {DeviceID: device4}},
|
||||||
ReadOnly: true,
|
ReadOnly: true,
|
||||||
RescanIntervalS: 600,
|
RescanIntervalS: 600,
|
||||||
Copiers: 1,
|
Copiers: 0,
|
||||||
Pullers: 16,
|
Pullers: 0,
|
||||||
Hashers: 0,
|
Hashers: 0,
|
||||||
AutoNormalize: true,
|
AutoNormalize: true,
|
||||||
MinDiskFreePct: 1,
|
MinDiskFreePct: 1,
|
||||||
|
@ -66,6 +66,11 @@ const (
|
|||||||
dbUpdateShortcutFile
|
dbUpdateShortcutFile
|
||||||
)
|
)
|
||||||
|
|
||||||
|
const (
|
||||||
|
defaultCopiers = 1
|
||||||
|
defaultPullers = 16
|
||||||
|
)
|
||||||
|
|
||||||
type dbUpdateJob struct {
|
type dbUpdateJob struct {
|
||||||
file protocol.FileInfo
|
file protocol.FileInfo
|
||||||
jobType int
|
jobType int
|
||||||
@ -102,7 +107,7 @@ type rwFolder struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func newRWFolder(m *Model, shortID uint64, cfg config.FolderConfiguration) *rwFolder {
|
func newRWFolder(m *Model, shortID uint64, cfg config.FolderConfiguration) *rwFolder {
|
||||||
return &rwFolder{
|
p := &rwFolder{
|
||||||
stateTracker: stateTracker{
|
stateTracker: stateTracker{
|
||||||
folder: cfg.ID,
|
folder: cfg.ID,
|
||||||
mut: sync.NewMutex(),
|
mut: sync.NewMutex(),
|
||||||
@ -131,6 +136,15 @@ func newRWFolder(m *Model, shortID uint64, cfg config.FolderConfiguration) *rwFo
|
|||||||
|
|
||||||
errorsMut: sync.NewMutex(),
|
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
|
// Helper function to check whether either the ignorePerm flag has been
|
||||||
|
Loading…
Reference in New Issue
Block a user