From a0b16fc841e65b95ed6ee66d1048bce6bce300e4 Mon Sep 17 00:00:00 2001 From: j Date: Sun, 31 Jan 2016 18:52:30 +0530 Subject: [PATCH] faster shutdown --- oml/nodes.py | 2 +- oml/tasks.py | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) 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))