From 646d8d74e55f2eddf882526a485e78178dbc285f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Zieli=C5=84ski?= Date: Sat, 21 Nov 2015 14:12:23 +0100 Subject: [PATCH] fix sendGraph --- scripts/sendGraph.py | 10 ++++++---- web/graphData.py | 4 ++-- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/scripts/sendGraph.py b/scripts/sendGraph.py index 5654ec9..941b6b9 100755 --- a/scripts/sendGraph.py +++ b/scripts/sendGraph.py @@ -52,7 +52,9 @@ def main(): get_peer_queue.put(k) for i in range(8): - threading.Thread(target=worker, args=[nodes, get_peer_queue, result_queue]).start() + t = threading.Thread(target=worker, args=[nodes, get_peer_queue, result_queue]) + t.daemon = True + t.start() for i in range(len(nodes)): peers, node_ip = result_queue.get() @@ -174,13 +176,13 @@ def get_edges_for_peers(edges, peers, node_ip): A = peer_ip B = node_ip - edge = { 'A': A, - 'B': B } + edge = { 'a': A, + 'b': B } if A not in edges: edges[A] = [] - if not([True for edge in edges[A] if edge['B'] == B]): + if not([True for edge in edges[A] if edge['b'] == B]): edges[A] += [edge] diff --git a/web/graphData.py b/web/graphData.py index 8b9f418..a7b84bd 100644 --- a/web/graphData.py +++ b/web/graphData.py @@ -48,11 +48,11 @@ def insert_graph_data(config, data, mail, ip, version): if len(nodes) == 0 or len(edges) == 0: return 'No valid nodes or edges' - uploaded_by = ip + uploaded_by = ip try: with NodeDB(config) as db: - db.insert_graph(nodes, edges, uploaded_by) + db.insert_graph(nodes, edges, uploaded_by) except Exception: traceback.print_exc() return 'Database failure'