mirror of
https://github.com/home-assistant/core.git
synced 2025-07-17 18:27:09 +00:00
Improve executor pool size / speedup python 3.5 (#8215)
* Improve executor pool size / speedup python36 * fix style * Add comment
This commit is contained in:
parent
1e4aec63ed
commit
442dcd584b
@ -48,9 +48,6 @@ SERVICE_CALL_LIMIT = 10 # seconds
|
|||||||
# Pattern for validating entity IDs (format: <domain>.<entity>)
|
# Pattern for validating entity IDs (format: <domain>.<entity>)
|
||||||
ENTITY_ID_PATTERN = re.compile(r"^(\w+)\.(\w+)$")
|
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.
|
# How long to wait till things that run on startup have to finish.
|
||||||
TIMEOUT_EVENT_START = 15
|
TIMEOUT_EVENT_START = 15
|
||||||
|
|
||||||
@ -114,9 +111,11 @@ class HomeAssistant(object):
|
|||||||
else:
|
else:
|
||||||
self.loop = loop or asyncio.get_event_loop()
|
self.loop = loop or asyncio.get_event_loop()
|
||||||
|
|
||||||
executor_opts = {
|
executor_opts = {'max_workers': 10}
|
||||||
'max_workers': EXECUTOR_POOL_SIZE
|
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):
|
if sys.version_info[:2] >= (3, 6):
|
||||||
executor_opts['thread_name_prefix'] = 'SyncWorker'
|
executor_opts['thread_name_prefix'] = 'SyncWorker'
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user