Don't send initial index twice, use more fetchers
This commit is contained in:
parent
74c27ad4e2
commit
e75e68faa0
16
model.go
16
model.go
@ -42,8 +42,7 @@ var (
|
|||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
RemoteFetchers = 4
|
FlagDeleted = 1 << 12
|
||||||
FlagDeleted = 1 << 12
|
|
||||||
|
|
||||||
idxBcastHoldtime = 15 * time.Second // Wait at least this long after the last index modification
|
idxBcastHoldtime = 15 * time.Second // Wait at least this long after the last index modification
|
||||||
idxBcastMaxDelay = 120 * time.Second // Unless we've already waited this long
|
idxBcastMaxDelay = 120 * time.Second // Unless we've already waited this long
|
||||||
@ -51,12 +50,13 @@ const (
|
|||||||
|
|
||||||
func NewModel(dir string) *Model {
|
func NewModel(dir string) *Model {
|
||||||
m := &Model{
|
m := &Model{
|
||||||
dir: dir,
|
dir: dir,
|
||||||
global: make(map[string]File),
|
global: make(map[string]File),
|
||||||
local: make(map[string]File),
|
local: make(map[string]File),
|
||||||
remote: make(map[string]map[string]File),
|
remote: make(map[string]map[string]File),
|
||||||
need: make(map[string]bool),
|
need: make(map[string]bool),
|
||||||
nodes: make(map[string]*protocol.Connection),
|
nodes: make(map[string]*protocol.Connection),
|
||||||
|
lastIdxBcast: time.Now(),
|
||||||
}
|
}
|
||||||
|
|
||||||
go m.printStats()
|
go m.printStats()
|
||||||
|
|||||||
@ -11,10 +11,6 @@ held for as short a time as possible.
|
|||||||
|
|
||||||
TODO(jb): Refactor this into smaller and cleaner pieces.
|
TODO(jb): Refactor this into smaller and cleaner pieces.
|
||||||
|
|
||||||
TODO(jb): Some kind of coalescing / rate limiting of index sending, so we don't
|
|
||||||
send hundreds of index updates in a short period if time when deleting files
|
|
||||||
etc.
|
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import (
|
import (
|
||||||
@ -29,6 +25,8 @@ import (
|
|||||||
"github.com/calmh/syncthing/buffers"
|
"github.com/calmh/syncthing/buffers"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
const RemoteFetchers = 8
|
||||||
|
|
||||||
func (m *Model) pullFile(name string) error {
|
func (m *Model) pullFile(name string) error {
|
||||||
m.RLock()
|
m.RLock()
|
||||||
var localFile = m.local[name]
|
var localFile = m.local[name]
|
||||||
@ -61,7 +59,7 @@ func (m *Model) pullFile(name string) error {
|
|||||||
local, remote := localFile.Blocks.To(globalFile.Blocks)
|
local, remote := localFile.Blocks.To(globalFile.Blocks)
|
||||||
var fetchDone sync.WaitGroup
|
var fetchDone sync.WaitGroup
|
||||||
|
|
||||||
// One local copy routing
|
// One local copy routine
|
||||||
|
|
||||||
fetchDone.Add(1)
|
fetchDone.Add(1)
|
||||||
go func() {
|
go func() {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user