mirror of
https://github.com/cwinfo/yggdrasil-map
synced 2024-11-25 20:31:35 +00:00
Merge pull request #11 from kyrias/sG-fixes
Skip not_found nodes, don't prefix error with "Error:"
This commit is contained in:
commit
3c90628f74
@ -153,7 +153,12 @@ def get_peers(con, path, nearbyPath=''):
|
|||||||
res = con.RouterModule_getPeers(path)
|
res = con.RouterModule_getPeers(path)
|
||||||
|
|
||||||
|
|
||||||
if res['error'] != 'none':
|
if res['error'] == 'not_found':
|
||||||
|
print('get_peers: node with path {:s} not found, skipping.'
|
||||||
|
.format(formatted_path))
|
||||||
|
return []
|
||||||
|
|
||||||
|
elif res['error'] != 'none':
|
||||||
print('get_peers: failed with error `{:s}` on {:s}, trying again. {:d} tries remaining.'
|
print('get_peers: failed with error `{:s}` on {:s}, trying again. {:d} tries remaining.'
|
||||||
.format(res['error'], formatted_path, retry-i))
|
.format(res['error'], formatted_path, retry-i))
|
||||||
elif res['result'] == 'timeout':
|
elif res['result'] == 'timeout':
|
||||||
@ -164,7 +169,7 @@ def get_peers(con, path, nearbyPath=''):
|
|||||||
|
|
||||||
i += 1
|
i += 1
|
||||||
|
|
||||||
print('get_peers: timed out on final try, skipping {:s}'
|
print('get_peers: failed on final try, skipping {:s}'
|
||||||
.format(formatted_path))
|
.format(formatted_path))
|
||||||
return []
|
return []
|
||||||
|
|
||||||
@ -251,7 +256,7 @@ def send_graph(nodes, edges):
|
|||||||
if r.text == 'OK':
|
if r.text == 'OK':
|
||||||
print('Done!')
|
print('Done!')
|
||||||
else:
|
else:
|
||||||
print('Error: {:s}'.format(r.text))
|
print('{:s}'.format(r.text))
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
main()
|
main()
|
||||||
|
Loading…
Reference in New Issue
Block a user