Parallell -> parallel (ref #13)

This commit is contained in:
Jakob Borg 2014-01-26 16:48:20 +01:00
parent b1ba976122
commit 6d3f8a2c06
4 changed files with 6 additions and 7 deletions

View File

@ -1,4 +1,3 @@
package auto package auto
import "github.com/cratonica/embed" import "github.com/cratonica/embed"

View File

@ -20,7 +20,7 @@ type Options struct {
ExternalServer string `ini:"global-announce-server" default:"syncthing.nym.se:22025" description:"Global server for announcements"` ExternalServer string `ini:"global-announce-server" default:"syncthing.nym.se:22025" description:"Global server for announcements"`
ExternalDiscovery bool `ini:"global-announce-enabled" default:"true" description:"Announce to the global announce server"` ExternalDiscovery bool `ini:"global-announce-enabled" default:"true" description:"Announce to the global announce server"`
LocalDiscovery bool `ini:"local-announce-enabled" default:"true" description:"Announce to the local network"` LocalDiscovery bool `ini:"local-announce-enabled" default:"true" description:"Announce to the local network"`
RequestsInFlight int `ini:"parallell-requests" default:"16" description:"Maximum number of blocks to request in parallell"` ParallelRequests int `ini:"parallel-requests" default:"16" description:"Maximum number of blocks to request in parallel"`
LimitRate int `ini:"max-send-kbps" description:"Limit outgoing data rate (kbyte/s)"` LimitRate int `ini:"max-send-kbps" description:"Limit outgoing data rate (kbyte/s)"`
ScanInterval time.Duration `ini:"rescan-interval" default:"60s" description:"Scan repository for changes this often"` ScanInterval time.Duration `ini:"rescan-interval" default:"60s" description:"Scan repository for changes this often"`
ConnInterval time.Duration `ini:"reconnection-interval" default:"60s" description:"Attempt to (re)connect to peers this often"` ConnInterval time.Duration `ini:"reconnection-interval" default:"60s" description:"Attempt to (re)connect to peers this often"`

View File

@ -210,7 +210,7 @@ func main() {
infoln("Deletes from peer nodes will be ignored") infoln("Deletes from peer nodes will be ignored")
} }
okln("Ready to synchronize (read-write)") okln("Ready to synchronize (read-write)")
m.StartRW(opts.Delete, opts.RequestsInFlight) m.StartRW(opts.Delete, opts.ParallelRequests)
} else { } else {
okln("Ready to synchronize (read only; no external updates accepted)") okln("Ready to synchronize (read only; no external updates accepted)")
} }

View File

@ -48,8 +48,8 @@ type Model struct {
sup suppressor sup suppressor
parallellRequests int parallelRequests int
limitRequestRate chan struct{} limitRequestRate chan struct{}
imut sync.Mutex // protects Index imut sync.Mutex // protects Index
} }
@ -130,7 +130,7 @@ func (m *Model) StartRW(del bool, threads int) {
m.rwRunning = true m.rwRunning = true
m.delete = del m.delete = del
m.parallellRequests = threads m.parallelRequests = threads
go m.cleanTempFiles() go m.cleanTempFiles()
if del { if del {
@ -491,7 +491,7 @@ func (m *Model) AddConnection(rawConn io.Closer, protoConn Connection) {
return return
} }
for i := 0; i < m.parallellRequests; i++ { for i := 0; i < m.parallelRequests; i++ {
i := i i := i
go func() { go func() {
if m.trace["pull"] { if m.trace["pull"] {