From d0533848f6b2f706fe8b29812db0d270ebf97203 Mon Sep 17 00:00:00 2001 From: Sheng Date: Thu, 21 Feb 2019 18:11:18 +0800 Subject: [PATCH] Pass max_workers to ThreadPoolExecutor --- webssh/handler.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/webssh/handler.py b/webssh/handler.py index c747a6e..3069e8b 100644 --- a/webssh/handler.py +++ b/webssh/handler.py @@ -8,6 +8,7 @@ import weakref import paramiko import tornado.web +from multiprocessing import cpu_count from concurrent.futures import ThreadPoolExecutor from tornado.ioloop import IOLoop from tornado.options import options @@ -168,7 +169,7 @@ class NotFoundHandler(MixinHandler, tornado.web.ErrorHandler): class IndexHandler(MixinHandler, tornado.web.RequestHandler): - executor = ThreadPoolExecutor() + executor = ThreadPoolExecutor(max_workers=cpu_count()*5) def initialize(self, loop, policy, host_keys_settings): super(IndexHandler, self).initialize(loop)