mirror of
https://github.com/octoleo/syncthing.git
synced 2024-12-23 11:28:59 +00:00
Merge pull request #1006 from AudriusButkevicius/defaults
Populate correct defaults
This commit is contained in:
commit
47b344ba12
@ -335,10 +335,20 @@ func (cfg *Configuration) prepare(myID protocol.DeviceID) {
|
||||
sort.Sort(DeviceConfigurationList(cfg.Devices))
|
||||
// Ensure that any loose devices are not present in the wrong places
|
||||
// Ensure that there are no duplicate devices
|
||||
// Ensure that puller settings are sane
|
||||
for i := range cfg.Folders {
|
||||
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
|
||||
}
|
||||
if cfg.Folders[i].Finishers == 0 {
|
||||
cfg.Folders[i].Finishers = 1
|
||||
}
|
||||
sort.Sort(FolderDeviceConfigurationList(cfg.Folders[i].Devices))
|
||||
}
|
||||
|
||||
|
@ -85,6 +85,9 @@ func TestDeviceConfig(t *testing.T) {
|
||||
Devices: []FolderDeviceConfiguration{{DeviceID: device1}, {DeviceID: device4}},
|
||||
ReadOnly: true,
|
||||
RescanIntervalS: 600,
|
||||
Copiers: 1,
|
||||
Pullers: 16,
|
||||
Finishers: 1,
|
||||
},
|
||||
}
|
||||
expectedDevices := []DeviceConfiguration{
|
||||
|
@ -250,6 +250,10 @@ func (p *Puller) pullerIteration(checksum bool) int {
|
||||
var pullWg sync.WaitGroup
|
||||
var doneWg sync.WaitGroup
|
||||
|
||||
if debug {
|
||||
l.Debugln(p, "c", p.copiers, "p", p.pullers, "f", p.finishers)
|
||||
}
|
||||
|
||||
for i := 0; i < p.copiers; i++ {
|
||||
copyWg.Add(1)
|
||||
go func() {
|
||||
|
Loading…
Reference in New Issue
Block a user