8000 Better locking while setting up components + discovery by balloob · Pull Request #4463 · home-assistant/core · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Better locking while setting up components + discovery #4463

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 19, 2016
Merged

Conversation

balloob
Copy link
Member
@balloob balloob commented Nov 19, 2016

Description:
This improves locking to avoid running parallel component setups during startup and discovery.

Related issue (if applicable): #4435 #4014

Checklist:

If the code does not interact with devices:

  • Local tests with tox run successfully. Your PR cannot be merged unless tests pass
  • Tests have been added to verify that the new code works.

@mention-bot
Copy link

@balloob, thanks for your PR! By analyzing the history of the files in this pull request, we identified @theolind, @pvizeli and @kellerza to be potential reviewers.

8000

@@ -1,7 +1,10 @@
"""Test discovery helpers."""
import asyncio

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'asyncio' imported but unused

# Convert values to dictionaries if they are None
config = defaultdict(
dict, {key: value or {} for key, value in config.items()})
new_config = OrderedDict()
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I always thought that we setup everything with an ordered dict but looks like I was wrong. Instead we converted everything to a normal dictionary, making each setup unpredictable.

Copy link
Member
@MartinHjelmare MartinHjelmare left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are two different types of discoveries that can be fired/listened for.
- listen/discover is for services. These are targetted at a component.
- listen_platform/discover_platform is for platforms. These are used by
components to allow discovery of their platofrms.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

platofrms -> platforms

@balloob
Copy link
Member Author
balloob commented Nov 19, 2016

For now we will still need that that lock in case people do not use the from_config_dict method (which is the case with remote instances)

@balloob balloob dismissed MartinHjelmare’s stale review November 19, 2016 16:18

Comments addressed

@balloob balloob merged commit d930c39 into dev Nov 19, 2016
@balloob balloob deleted the discovery-setup branch November 19, 2016 16:18
@home-assistant home-assistant locked and limited conversation to collaborators Mar 17, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants
0