prevent the dispatcher from using a nonsensical max_workers value

This commit is contained in:
Ryan Petrello 2018-11-16 10:16:39 -05:00
parent e24d63ea9a
commit 37234ca66e
No known key found for this signature in database
GPG Key ID: F2AA5F2122351777

View File

@ -296,6 +296,10 @@ class AutoscalePool(WorkerPool):
# 5 workers per GB of total memory
self.max_workers = (total_memory_gb * 5)
# max workers can't be less than min_workers
self.max_workers = max(self.min_workers, self.max_workers)
logger.warning(self.debug_meta)
@property
def should_grow(self):
if len(self.workers) < self.min_workers: