From 0def130b4acdd93e756d6dd96873624bbffb94f0 Mon Sep 17 00:00:00 2001 From: j Date: Tue, 1 Dec 2015 10:39:47 +0100 Subject: [PATCH] dont queue pull if pull is running --- oml/node/server.py | 4 ++-- oml/nodes.py | 6 +++++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/oml/node/server.py b/oml/node/server.py index 49e9f49..71f5d47 100644 --- a/oml/node/server.py +++ b/oml/node/server.py @@ -221,8 +221,8 @@ class Handler(http.server.SimpleHTTPRequestHandler): logger.debug('PEER %s IS UNKNOWN SEND 403', user_id) response_status = (403, 'UNKNOWN USER') content = {} - else: - logger.debug('RESPONSE %s: %s', action, content) + #else: + # logger.debug('RESPONSE %s: %s', action, content) self.write_response(response_status, content) def write_response(self, response_status, content): diff --git a/oml/nodes.py b/oml/nodes.py index e6168f8..d7d7327 100644 --- a/oml/nodes.py +++ b/oml/nodes.py @@ -35,6 +35,7 @@ ENCODING='base64' class Node(Thread): _running = True + _pulling = False host = None local = None online = False @@ -64,8 +65,10 @@ class Node(Thread): elif action == 'ping': self.online = self.can_connect() elif action == 'pull': + self._pulling = True self.online = self.can_connect() self.pullChanges() + self._pulling = False else: logger.debug('unknown action %s', action) @@ -75,7 +78,8 @@ class Node(Thread): #return Thread.join(self) def pull(self): - self._q.put('pull') + if not self._pulling: + self._q.put('pull') def ping(self): self._q.put('ping')