commit 2c36518e46496893b23b59e04a3837fac3756188
parent 2c6608493fc5b0c3e206a8956a242dc01620cbe2
Author: ThomasV <thomasv@gitorious>
Date: Fri, 15 Aug 2014 08:09:43 +0200
handle non-answering servers in peers script
Diffstat:
1 file changed, 12 insertions(+), 1 deletion(-)
diff --git a/scripts/peers b/scripts/peers
@@ -87,12 +87,23 @@ for i in reached_servers:
i.send_request({'method':'blockchain.headers.subscribe','params':[]}, results_queue)
results = {}
+t0 = time.time()
while reached_servers:
- i, r = results_queue.get(timeout=10000)
+ try:
+ i, r = results_queue.get(timeout=1)
+ except:
+ if time.time() - t0 > 10:
+ break
+ else:
+ continue
results[i.server] = r.get('result')
reached_servers.remove(i)
i.stop()
+for i in reached_servers:
+ print i.server, "did not answer"
+print "%d answers"%len(results)
+
errors = analyze(results).keys()
for n,v in sorted(results.items(), key=lambda x:x[1]['block_height']):