Commit 7631c51207229346467d70e5b00b51c6f860c61b
don't attempt to connect to peers while migration is running
Matt McKegg committed on 6/17/2017, 2:39:37 PMParent: a8eda5e5db9ec86d6df1064d0c0c8e1c23a5d62f
Files changed
index.js | changed |
plugins/gossip/schedule.js | changed |
index.js | ||
---|---|---|
@@ -77,14 +77,18 @@ | ||
77 | 77 | |
78 | 78 | //remove this, but we'll need something to make a progress bar |
79 | 79 | //otherwise people will get confused about what is happening. |
80 | 80 | |
81 | - | |
82 | 81 | |
82 | + | |
83 | 83 | return { |
84 | 84 | id : feed.id, |
85 | 85 | keys : opts.keys, |
86 | 86 | |
87 | + ready : function () { | |
88 | + return ssb.ready.value | |
89 | + }, | |
90 | + | |
87 | 91 | progress : function () { |
88 | 92 | return ssb.progress |
89 | 93 | }, |
90 | 94 | |
@@ -157,7 +161,4 @@ | ||
157 | 161 | //when creating a Sbot instance. |
158 | 162 | appKey: require('./lib/ssb-cap') |
159 | 163 | }) |
160 | 164 | .use(SSB) |
161 | - | |
162 | - | |
163 | - |
plugins/gossip/schedule.js | ||
---|---|---|
@@ -143,8 +143,12 @@ | ||
143 | 143 | if(connecting) return |
144 | 144 | connecting = true |
145 | 145 | setTimeout(function () { |
146 | 146 | connecting = false |
147 | + | |
148 | + // don't attempt to connect while migration is running | |
149 | + if (!server.ready()) return | |
150 | + | |
147 | 151 | var ts = Date.now() |
148 | 152 | var peers = gossip.peers() |
149 | 153 | |
150 | 154 | var connected = peers.filter(and(isConnect, not(isLocal), not(isFriend))).length |
@@ -238,5 +242,4 @@ | ||
238 | 242 | exports.isLocal = isLocal |
239 | 243 | exports.isFriend = isFriend |
240 | 244 | exports.isConnectedOrConnecting = isConnect |
241 | 245 | exports.select = select |
242 | - |
Built with git-ssb-web