shorter timeouts in synchronizer, so that it terminates properly

This commit is contained in:
ThomasV 2014-07-29 12:23:42 +02:00
parent 58c817f81a
commit 71d97eeecc
1 changed files with 4 additions and 11 deletions

View File

@ -61,7 +61,7 @@ class WalletSynchronizer(threading.Thread):
self.running = True self.running = True
while self.is_running(): while self.is_running():
while not self.network.is_connected(): while not self.network.is_connected():
time.sleep(1) time.sleep(0.1)
self.run_interface() self.run_interface()
def run_interface(self): def run_interface(self):
@ -123,24 +123,17 @@ class WalletSynchronizer(threading.Thread):
# 2. get a response # 2. get a response
try: try:
r = self.queue.get(block=True, timeout=1) r = self.queue.get(timeout=0.1)
except Queue.Empty: except Queue.Empty:
continue continue
# see if it changed # 3. process response
#if interface != self.network.interface:
# break
if not r:
continue
# 3. handle response
method = r['method'] method = r['method']
params = r['params'] params = r['params']
result = r.get('result') result = r.get('result')
error = r.get('error') error = r.get('error')
if error: if error:
print "error", r print_error("error", r)
continue continue
if method == 'blockchain.address.subscribe': if method == 'blockchain.address.subscribe':