Improve executor pool size / speedup python 3.5 (#8215)

* Improve executor pool size / speedup python36

* fix style

* Add comment
pull/8223/head
Pascal Vizeli 2017-06-27 03:18:42 +02:00 committed by Paulus Schoutsen
parent 1e4aec63ed
commit 442dcd584b
1 changed files with 5 additions and 6 deletions

View File

@ -48,9 +48,6 @@ SERVICE_CALL_LIMIT = 10 # seconds
# Pattern for validating entity IDs (format: <domain>.<entity>)
ENTITY_ID_PATTERN = re.compile(r"^(\w+)\.(\w+)$")
# Size of a executor pool
EXECUTOR_POOL_SIZE = 10
# How long to wait till things that run on startup have to finish.
TIMEOUT_EVENT_START = 15
@ -114,9 +111,11 @@ class HomeAssistant(object):
else:
self.loop = loop or asyncio.get_event_loop()
executor_opts = {
'max_workers': EXECUTOR_POOL_SIZE
}
executor_opts = {'max_workers': 10}
if sys.version_info[:2] >= (3, 5):
# It will default set to the number of processors on the machine,
# multiplied by 5. That is better for overlap I/O workers.
executor_opts['max_workers'] = None
if sys.version_info[:2] >= (3, 6):
executor_opts['thread_name_prefix'] = 'SyncWorker'