Make housekeeping build spares with an executor

Change-Id: Ie45ddb602f7b8ba71138b217c1f0ce70ffca2c65
Closes-Bug: #1713873
This commit is contained in:
Adam Harwell 2017-08-29 17:07:09 -07:00
parent 08bb17abeb
commit c71e46cfdb
1 changed files with 6 additions and 4 deletions

View File

@ -50,10 +50,12 @@ class SpareAmphora(object):
LOG.info("Initiating creation of %d spare amphora.", diff_count)
# Call Amphora Create Flow diff_count times
for i in range(1, diff_count + 1):
LOG.debug("Starting amphorae number %d ...", i)
self.cw.create_amphora()
with futures.ThreadPoolExecutor(
max_workers=CONF.house_keeping.spare_amphora_pool_size
) as executor:
for i in range(1, diff_count + 1):
LOG.debug("Starting amphorae number %d ...", i)
executor.submit(self.cw.create_amphora)
else:
LOG.debug("Current spare amphora count satisfies the requirement")