1 | const pull = require('pull-stream')
|
2 | const validate = require('ssb-validate')
|
3 | const ssbClient = require('ssb-client')
|
4 |
|
5 | let state = {
|
6 | queue: [],
|
7 | feeds: {}
|
8 | }
|
9 |
|
10 | ssbClient(function (err, sbot) {
|
11 | if (err) console.error(err)
|
12 | let n = 0
|
13 | let ts = Date.now()
|
14 | const start = Date.now()
|
15 | pull(
|
16 | sbot.ebt._dump(),
|
17 | pull.drain(function (msg) {
|
18 | state = validate.append(state, msg)
|
19 | let _ts
|
20 | n++
|
21 | if ((_ts = Date.now()) > ts + 1000) {
|
22 | console.log(Object.keys(state.feeds).length, state.queue.length)
|
23 | console.log(n, n / ((Date.now() - start) / 1000))
|
24 | ts = _ts
|
25 | }
|
26 | }, sbot.close)
|
27 | )
|
28 | })
|