From ac85bea11146b0544b5fdb69397f33a267cb3086 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sybren=20A=2E=20St=C3=BCvel?= Date: Tue, 13 Jun 2017 13:45:57 +0200 Subject: [PATCH] Some asyncio tweaks. --- blender_cloud/async_loop.py | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/blender_cloud/async_loop.py b/blender_cloud/async_loop.py index 731efab..80c1fa0 100644 --- a/blender_cloud/async_loop.py +++ b/blender_cloud/async_loop.py @@ -33,16 +33,10 @@ _loop_kicking_operator_running = False def setup_asyncio_executor(): - """Sets up AsyncIO to run on a single thread. + """Sets up AsyncIO to run properly on each platform.""" - This ensures that only one Pillar HTTP call is performed at the same time. Other - calls that could be performed in parallel are queued, and thus we can - reliably cancel them. - """ import sys - executor = concurrent.futures.ThreadPoolExecutor() - if sys.platform == 'win32': asyncio.get_event_loop().close() # On Windows, the default event loop is SelectorEventLoop, which does @@ -52,6 +46,8 @@ def setup_asyncio_executor(): asyncio.set_event_loop(loop) else: loop = asyncio.get_event_loop() + + executor = concurrent.futures.ThreadPoolExecutor(max_workers=10) loop.set_default_executor(executor) # loop.set_debug(True)