diff --git a/gunicorn/workers/gthread.py b/gunicorn/workers/gthread.py index 48e93764..a4c4c771 100644 --- a/gunicorn/workers/gthread.py +++ b/gunicorn/workers/gthread.py @@ -85,11 +85,15 @@ class ThreadWorker(base.Worker): "Check the number of worker connections and threads.") def init_process(self): - self.tpool = futures.ThreadPoolExecutor(max_workers=self.cfg.threads) + self.tpool = self.get_thread_pool() self.poller = selectors.DefaultSelector() self._lock = RLock() super(ThreadWorker, self).init_process() + def get_thread_pool(self): + """Override this method to customize how the thread pool is created""" + return futures.ThreadPoolExecutor(max_workers=self.cfg.threads) + def handle_quit(self, sig, frame): self.alive = False # worker_int callback