git ssb

4+

Dominic / scuttlebot



Commit 00dd21feb644ef3bc4da675b0b9edf96305343b8

detect when flume gets stuck, so I know how often it happens, so I can know how long I need to wait to test it, since I can't reproduce it yet

Dominic Tarr committed on 4/6/2017, 7:06:56 PM
Parent: b0c67749a854dd5b744d0fd4e950a350d8839dfe

Files changed

.gitignorechanged
index.jschanged
.gitignoreView
@@ -2,4 +2,5 @@
22 .privatekey
33 node_modules
44 sbot.js
55 .ssbrc
6 +stuck.log
index.jsView
@@ -60,18 +60,37 @@
6060 }
6161
6262 function since () {
6363 var plugs = {}
64 + var sync = false
6465 for(var k in ssb) {
65- if(ssb[k] && isObject(ssb[k]) && isFunction(ssb[k].since))
66 + if(ssb[k] && isObject(ssb[k]) && isFunction(ssb[k].since)) {
6667 plugs[k] = ssb[k].since.value
68 + sync = sync || (plugs[k] === ssb.since.value)
69 + }
6770 }
6871 return {
6972 since: ssb.since.value,
70- plugins: plugs
73 + plugins: plugs,
74 + sync: sync
7175 }
7276 }
7377
78 + var state = since()
79 + setInterval(function (){
80 + var _state = since()
81 + 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')
89 + }
90 + state = _state
91 + }, 1000).unref()
92 +
7493 return {
7594 id : feed.id,
7695 keys : opts.keys,
7796
@@ -146,4 +165,12 @@
146165 appKey: require('./lib/ssb-cap')
147166 })
148167 .use(SSB)
149168
169 +
170 +
171 +
172 +
173 +
174 +
175 +
176 +

Built with git-ssb-web