Commit 7502cc2d32052289c680ccb0496db5b044f57ca6
added legacy progress back in, tests pass
Matt McKegg committed on 3/27/2017, 4:08:28 AMParent: 760209e9a1d1d9cb92f5b08651e9884ee1624c1c
Files changed
plugins/replicate.js | changed |
test/random.js | changed |
plugins/replicate.js | ||
---|---|---|
@@ -51,8 +51,9 @@ | ||
51 | 51 … | |
52 | 52 … | debounce(function () { |
53 | 53 … | // only list loaded feeds once we know about all of them! |
54 | 54 … | var feeds = loadedFriends ? Object.keys(toSend).length : null |
55 … | + var legacyProgress = 0 | |
55 | 56 … | |
56 | 57 … | var pendingFeeds = new Set() |
57 | 58 … | var pendingPeers = {} |
58 | 59 … | |
@@ -70,11 +71,16 @@ | ||
70 | 71 … | } |
71 | 72 … | } |
72 | 73 … | }) |
73 | 74 … | |
75 … | + for (var k in toSend) { | |
76 … | + legacyProgress += toSend[k] | |
77 … | + } | |
78 … | + | |
74 | 79 … | var progress = { |
75 | 80 … | id: sbot.id, |
76 | 81 … | rate, // rate of messages written to sbot |
82 … | + progress: legacyProgress, // LEGACY: needed for test/random.js to pass | |
77 | 83 … | feeds, // total number of feeds we want to replicate |
78 | 84 … | pendingPeers, // number of pending feeds per peer |
79 | 85 … | incompleteFeeds: pendingFeeds.size // number of feeds with pending messages to download |
80 | 86 … | } |
test/random.js | ||
---|---|---|
@@ -232,11 +232,13 @@ | ||
232 | 232 … | console.log("DISCONNECT", -c) |
233 | 233 … | }) |
234 | 234 … | }) |
235 | 235 … | |
236 … | + var drain | |
237 … | + | |
236 | 238 … | pull( |
237 | 239 … | animalFriends.replicate.changes(), |
238 | - pull.drain(function (prog) { | |
240 … | + drain = pull.drain(function (prog) { | |
239 | 241 … | prog.id = 'animal friends' |
240 | 242 … | var target = F+N+3 |
241 | 243 … | console.log(prog, target) |
242 | 244 … | // progress.push(prog) |
@@ -245,8 +247,9 @@ | ||
245 | 247 … | console.log("DONE!!!!") |
246 | 248 … | var time = (Date.now() - start) / 1000 |
247 | 249 … | console.log('replicated', target, 'messages in', time, 'at rate',target/time) |
248 | 250 … | animalFriends.close(true) |
251 … | + drain.abort() | |
249 | 252 … | t.end() |
250 | 253 … | } |
251 | 254 … | }) |
252 | 255 … | ) |
Built with git-ssb-web