git ssb

4+

Dominic / scuttlebot



Commit d05b0a6b310964c2e5fd32ad53278ff8db0603eb

dump some useful information about view state

Dominic Tarr committed on 4/15/2017, 7:08:56 PM
Parent: 631d5188760440036b222ab5076289ad46fb76ea

Files changed

index.jschanged
index.jsView
@@ -70,25 +70,35 @@
7070 }
7171 return {
7272 since: ssb.since.value,
7373 plugins: plugs,
74- sync: sync
74 + sync: sync,
7575 }
7676 }
7777
78 + var _views, _prev
79 +
7880 var state = since()
7981 setInterval(function (){
8082 var _state = since()
83 + if(_state.since == undefined) return
8184 if(state && !state.sync && !_state.sync && state.since == _state.since) {
82- console.log(state, _state)
83- //flume is stuck again.
84- require('fs').appendFileSync('stuck.log', JSON.stringify({
85- time: new Date(),
86- state: state
87- }, null, 2) + '\n\n')
88- throw new Error('flume is stuck')
85 + var c = 0, t = 0
86 +
87 + for(var k in _state.plugins) {
88 + c += state.plugins[k]
89 + t++
90 + }
91 +
92 + if(c/t !== _views || c/t != _state.since) {
93 + console.log('Rebuilding Indexes:', c/t, _views, (c/t)/_state.since)
94 + }
8995 }
96 + else if(_state.since != _prev)
97 + console.log("indexes synchronised:", _state.since)
98 +
9099 state = _state
100 + _prev = state.since
91101 }, 1000).unref()
92102
93103 return {
94104 id : feed.id,
@@ -105,11 +115,10 @@
105115 close : valid.async(close),
106116
107117 publish : valid.async(feed.add, 'string|msgContent'),
108118 add : valid.async(ssb.add, 'msg'),
109- get : valid.async(ssb.get, 'msgId'),
119 + get : valid.async(ssb.get, 'msgId|number'),
110120
111- pre : ssb.pre,
112121 post : ssb.post,
113122
114123 since : since,
115124
@@ -173,4 +182,22 @@
173182
174183
175184
176185
186 +
187 +
188 +
189 +
190 +
191 +
192 +
193 +
194 +
195 +
196 +
197 +
198 +
199 +
200 +
201 +
202 +
203 +

Built with git-ssb-web