Limit service description loading to a single thread#11733
Merged
Conversation
balloob
reviewed
Jan 18, 2018
| if loading_tasks: | ||
| yield from asyncio.wait(loading_tasks, loop=hass.loop) | ||
| if missing: | ||
| loaded = yield from hass.async_add_job(load_services_files, missing) |
Member
There was a problem hiding this comment.
This seems to no longer use the YAML cache?
Contributor
Author
There was a problem hiding this comment.
We cache needed descriptions in description_cache = hass.data[SERVICE_DESCRIPTION_CACHE] but the complete YAML file is discarded because it can contain many descriptions that we do not need.
That has not changed with this PR. However, apparently I got confused during the multiple reworks of the original PR and named yaml_cache poorly so now I renamed it.
balloob
approved these changes
Jan 19, 2018
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description:
With #11479 we started loading all required
services.yamlfiles concurrently. The idea was that one file could be parsed while the next one was loaded from disk. However, this has turned out to be too taxing on slow hardware like the Raspberry Pi and timer synchronization problems can result:This PR reworks the loading to all happen in a single thread, hopefully leaving room for the rest of Home Assistant to do its tasks.
Related issue (if applicable): fixes # (none yet)
Checklist:
If the code does not interact with devices:
toxrun successfully.