summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJakob Borg <jakob@nym.se>2014-07-03 12:30:10 +0200
committerJakob Borg <jakob@nym.se>2014-07-03 12:30:10 +0200
commit2f5a822ca4c04847676fe9168e4d26decc6c1970 (patch)
tree6172af8faa1652bce3b88b5a31383b8e7fb616d9
parentbc1d04f0b92c0359a399cd38924cd6c58f82eb6e (diff)
Send initial index in batches
-rw-r--r--model/model.go9
1 files changed, 8 insertions, 1 deletions
diff --git a/model/model.go b/model/model.go
index 2536b339a1..4240181966 100644
--- a/model/model.go
+++ b/model/model.go
@@ -520,7 +520,14 @@ func (m *Model) AddConnection(rawConn io.Closer, protoConn protocol.Connection)
if debug {
l.Debugf("IDX(out/initial): %s: %q: %d files", nodeID, repo, len(idx))
}
- protoConn.Index(repo, idx)
+ const batchSize = 1000
+ for i := 0; i < len(idx); i += batchSize {
+ if len(idx[i:]) < batchSize {
+ protoConn.Index(repo, idx[i:])
+ } else {
+ protoConn.Index(repo, idx[i:i+batchSize])
+ }
+ }
}
}()
}