git ssb

4+

Dominic / scuttlebot



Commit 7502cc2d32052289c680ccb0496db5b044f57ca6

added legacy progress back in, tests pass

Matt McKegg committed on 3/27/2017, 4:08:28 AM
Parent: 760209e9a1d1d9cb92f5b08651e9884ee1624c1c

Files changed

plugins/replicate.jschanged
test/random.jschanged
plugins/replicate.jsView
@@ -51,8 +51,9 @@
5151
5252 debounce(function () {
5353 // only list loaded feeds once we know about all of them!
5454 var feeds = loadedFriends ? Object.keys(toSend).length : null
55 + var legacyProgress = 0
5556
5657 var pendingFeeds = new Set()
5758 var pendingPeers = {}
5859
@@ -70,11 +71,16 @@
7071 }
7172 }
7273 })
7374
75 + for (var k in toSend) {
76 + legacyProgress += toSend[k]
77 + }
78 +
7479 var progress = {
7580 id: sbot.id,
7681 rate, // rate of messages written to sbot
82 + progress: legacyProgress, // LEGACY: needed for test/random.js to pass
7783 feeds, // total number of feeds we want to replicate
7884 pendingPeers, // number of pending feeds per peer
7985 incompleteFeeds: pendingFeeds.size // number of feeds with pending messages to download
8086 }
test/random.jsView
@@ -232,11 +232,13 @@
232232 console.log("DISCONNECT", -c)
233233 })
234234 })
235235
236 + var drain
237 +
236238 pull(
237239 animalFriends.replicate.changes(),
238- pull.drain(function (prog) {
240 + drain = pull.drain(function (prog) {
239241 prog.id = 'animal friends'
240242 var target = F+N+3
241243 console.log(prog, target)
242244 // progress.push(prog)
@@ -245,8 +247,9 @@
245247 console.log("DONE!!!!")
246248 var time = (Date.now() - start) / 1000
247249 console.log('replicated', target, 'messages in', time, 'at rate',target/time)
248250 animalFriends.close(true)
251 + drain.abort()
249252 t.end()
250253 }
251254 })
252255 )

Built with git-ssb-web