mirror of
https://github.com/frappe/gunicorn.git
synced 2026-01-14 11:09:11 +08:00
Move ThreadPoolExecutor() creation into own method
Move ThreadPoolExecutor() creation into it's own method so it is easier to override when subclassing.
This commit is contained in:
parent
5680320e5c
commit
a2a8bc1ae6
@ -85,11 +85,15 @@ class ThreadWorker(base.Worker):
|
|||||||
"Check the number of worker connections and threads.")
|
"Check the number of worker connections and threads.")
|
||||||
|
|
||||||
def init_process(self):
|
def init_process(self):
|
||||||
self.tpool = futures.ThreadPoolExecutor(max_workers=self.cfg.threads)
|
self.tpool = self.get_thread_pool()
|
||||||
self.poller = selectors.DefaultSelector()
|
self.poller = selectors.DefaultSelector()
|
||||||
self._lock = RLock()
|
self._lock = RLock()
|
||||||
super(ThreadWorker, self).init_process()
|
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):
|
def handle_quit(self, sig, frame):
|
||||||
self.alive = False
|
self.alive = False
|
||||||
# worker_int callback
|
# worker_int callback
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user