Commit 243045ea3fb6700ba9693c23cceb779a53987e4b
Merge branch 'master' of github.com:ssbc/scuttlebot into _master
Dominic Tarr committed on 4/10/2017, 3:51:50 PMParent: 34376147b67c10d43f8b82ccd4b103cdca869d2b
Parent: 6142de4291409edc60c0927ff49549d8ba825589
Files changed
plugins/replicate.js | changed |
plugins/replicate.js | ||
---|---|---|
@@ -59,19 +59,17 @@ | ||
59 | 59 … | var pendingPeers = {} |
60 | 60 … | var legacyToRecv = {} |
61 | 61 … | |
62 | 62 … | Object.keys(pendingFeedsForPeer).forEach(function (peerId) { |
63 | - if (pendingFeedsForPeer[peerId]) { | |
63 … | + if (pendingFeedsForPeer[peerId] && pendingFeedsForPeer[peerId].size) { | |
64 | 64 … | Object.keys(toSend).forEach(function (feedId) { |
65 | 65 … | if (peerHas[peerId] && peerHas[peerId][feedId]) { |
66 | 66 … | if (peerHas[peerId][feedId] > toSend[feedId]) { |
67 | 67 … | pendingFeeds.add(feedId) |
68 | 68 … | } |
69 | 69 … | } |
70 | 70 … | }) |
71 | - if (pendingFeedsForPeer[peerId].size) { | |
72 | - pendingPeers[peerId] = pendingFeedsForPeer[peerId].size | |
73 | - } | |
71 … | + pendingPeers[peerId] = pendingFeedsForPeer[peerId].size | |
74 | 72 … | } |
75 | 73 … | }) |
76 | 74 … | |
77 | 75 … | for (var k in toSend) { |
@@ -250,8 +248,10 @@ | ||
250 | 248 … | |
251 | 249 … | sbot.emit('replicate:start', rpc) |
252 | 250 … | rpc.on('closed', function () { |
253 | 251 … | sbot.emit('replicate:finish', toSend) |
252 … | + delete pendingFeedsForPeer[rpc.id] | |
253 … | + debounce.set() | |
254 | 254 … | }) |
255 | 255 … | var errorsSeen = {} |
256 | 256 … | pull( |
257 | 257 … | upto({live: opts.live}), |
@@ -287,9 +287,12 @@ | ||
287 | 287 … | err.stack) |
288 | 288 … | } |
289 | 289 … | } |
290 | 290 … | |
291 | - pendingFeedsForPeer[rpc.id].delete(upto.id) | |
291 … | + if (pendingFeedsForPeer[rpc.id]) { | |
292 … | + pendingFeedsForPeer[rpc.id].delete(upto.id) | |
293 … | + } | |
294 … | + | |
292 | 295 … | debounce.set() |
293 | 296 … | }) |
294 | 297 … | ) |
295 | 298 … |
Built with git-ssb-web