commit 11a8e04dd07f39988a278f907d2d9dd8a9e12949
parent 8957c705ac367d9762de29bb9a5fbdea8b38be2a
Author: thomasv <thomasv@gitorious>
Date: Wed, 17 Oct 2012 17:47:48 +0200
add timeout
Diffstat:
1 file changed, 8 insertions(+), 4 deletions(-)
diff --git a/scripts/servers b/scripts/servers
@@ -14,16 +14,20 @@ for i in interfaces:
else:
servers.remove(i.server)
-while servers:
- for i in interfaces:
+for i in interfaces:
+ while True:
try:
- r = i.responses.get(False)
+ r = i.responses.get(True,1)
except Queue.Empty:
- continue
+ break
if r.get('method') == 'blockchain.numblocks.subscribe':
results.append((i.host, r.get('result')))
servers.remove(i.server)
+ break
+
+for s in servers:
+ print "%30s "%s, "timed out"
from collections import defaultdict
d = defaultdict(int)