git ssb

2+

mixmix / ticktack



Commit 3627ef5bb2d0af90d48c88e2897c15df3cd2dd11

add cache to mySeq checker

mix irving committed on 5/31/2018, 11:35:30 AM
Parent: 5f86bdb837a971c779cc9be81fd7c8e39090a252

Files changed

ftu/manageProgress.jschanged
ftu/manageProgress.jsView
@@ -24,9 +24,9 @@
2424 // )
2525
2626 // watch progress (db size) ??
2727 // sbot.progress(console.log)
28- //
28+
2929 sbot.gossip.peers((err, peers) => {
3030 if (err) return console.error(err)
3131
3232 connectToPeers({ sbot, peers, state })
@@ -66,13 +66,15 @@
6666 if (importComplete) sink.abort(() => console.log('stopping watchCurrentSequence'))
6767 })
6868 }
6969
70+var cache = {}
7071 function watchLatestSequence ({ sbot, period, state }) {
7172 const feedId = sbot.id
7273 sbot.ebt.peerStatus(feedId, (err, data) => {
7374 if (err) return setTimeout(() => watchLatestSequence({ sbot, period, state }), period)
7475
76+ cache = data = Object.assign({}, cache, data)
7577 const currentLatest = resolve(state.mySequence.latest)
7678
7779 const remoteSeqs = map(data.peers, (val) => val.seq)
7880 .filter(s => s >= currentLatest) // only keep remote seq that confirm or update backup seq

Built with git-ssb-web