Merge "Fix shutdown ordering"

This commit is contained in:
Zuul 2020-04-07 22:02:54 +00:00 committed by Gerrit Code Review
commit 4a8694f5f9
2 changed files with 6 additions and 4 deletions

View File

@ -146,13 +146,13 @@ class TaskManager:
while True:
task = self.queue.get()
if not task:
if not self._running:
break
continue
self.log.debug("Manager %s running task %s (queue %s)" %
(self.name, task.name, self.queue.qsize()))
task.run(self)
self.queue.task_done()
if not self._running:
break
except Exception:
self.log.exception("Task manager died")
raise

View File

@ -893,8 +893,6 @@ class NodePool(threading.Thread):
# completed before we continue the shutdown.
if self.isAlive():
self.join()
if self.config:
provider_manager.ProviderManager.stopProviders(self.config)
if self._cleanup_thread:
self._cleanup_thread.stop()
@ -917,6 +915,10 @@ class NodePool(threading.Thread):
self.log.debug("Waiting for %s" % thd.name)
thd.join()
# Stop providers after all the cleanup threads have stopped.
if self.config:
provider_manager.ProviderManager.stopProviders(self.config)
if self.zk:
self.zk.disconnect()
self.log.debug("Finished stopping")