faster shutdown

This commit is contained in:
j 2016-01-31 18:52:30 +05:30
parent c844aae72e
commit a0b16fc841
2 changed files with 5 additions and 4 deletions

View file

@ -481,7 +481,7 @@ class Nodes(Thread):
for node in list(self._nodes.values()): for node in list(self._nodes.values()):
if self._running: if self._running:
node.online = node.can_connect() node.online = node.can_connect()
if node.online: if self._running and node.online:
node.pullChanges() node.pullChanges()
self._pulling = False self._pulling = False

View file

@ -25,7 +25,7 @@ class Tasks(Thread):
from user.models import export_list, update_user_peering from user.models import export_list, update_user_peering
while self.connected: while self.connected:
m = self.q.get() m = self.q.get()
if m: if m and self.connected:
try: try:
action, data = m action, data = m
logger.debug('%s start', action) logger.debug('%s start', action)
@ -60,6 +60,7 @@ class Tasks(Thread):
return Thread.join(self) return Thread.join(self)
def queue(self, action, data=None): def queue(self, action, data=None):
logger.debug('%s queued', action) if self.connected:
self.q.put((action, data)) logger.debug('%s queued', action)
self.q.put((action, data))