diff --git a/oml/nodes.py b/oml/nodes.py index 86a85a8..266855b 100644 --- a/oml/nodes.py +++ b/oml/nodes.py @@ -481,7 +481,7 @@ class Nodes(Thread): for node in list(self._nodes.values()): if self._running: node.online = node.can_connect() - if node.online: + if self._running and node.online: node.pullChanges() self._pulling = False diff --git a/oml/tasks.py b/oml/tasks.py index 88946c2..08fed06 100644 --- a/oml/tasks.py +++ b/oml/tasks.py @@ -25,7 +25,7 @@ class Tasks(Thread): from user.models import export_list, update_user_peering while self.connected: m = self.q.get() - if m: + if m and self.connected: try: action, data = m logger.debug('%s start', action) @@ -60,6 +60,7 @@ class Tasks(Thread): return Thread.join(self) def queue(self, action, data=None): - logger.debug('%s queued', action) - self.q.put((action, data)) + if self.connected: + logger.debug('%s queued', action) + self.q.put((action, data))