Commit 3b0f6e76 by Timothée Peignier

ensure executor is correctly shutdown

parent 60612cb9
...@@ -20,7 +20,6 @@ class Compiler(object): ...@@ -20,7 +20,6 @@ class Compiler(object):
def __init__(self, storage=default_storage, verbose=False): def __init__(self, storage=default_storage, verbose=False):
self.storage = storage self.storage = storage
self.verbose = verbose self.verbose = verbose
self.executor = futures.ThreadPoolExecutor(max_workers=multiprocessing.cpu_count())
@property @property
def compilers(self): def compilers(self):
...@@ -47,7 +46,8 @@ class Compiler(object): ...@@ -47,7 +46,8 @@ class Compiler(object):
return output_path return output_path
else: else:
return input_path return input_path
return self.executor.map(_compile, paths) with futures.ThreadPoolExecutor(max_workers=multiprocessing.cpu_count()) as executor:
return list(executor.map(_compile, paths))
def output_path(self, path, extension): def output_path(self, path, extension):
path = os.path.splitext(path) path = os.path.splitext(path)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment