Skip to content
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

Fix Non-thread-safe operation invoked on an event loop other than the current one #2249

Merged
merged 1 commit into from
Oct 31, 2021

Conversation

bdraco
Copy link
Contributor

@bdraco bdraco commented Oct 31, 2021

2021-10-31 15:05:52 ERROR (MainThread) [custom_components.hacs] Task setup_frontend failed: Non-thread-safe operation invoked on an event loop other than the current one

… current one

`2021-10-31 15:05:52 ERROR (MainThread) [custom_components.hacs] Task setup_frontend failed: Non-thread-safe operation invoked on an event loop other than the current one`
@@ -18,7 +18,7 @@ class Task(HacsTask):

stages = [HacsStage.SETUP]

def execute(self) -> None:
async def async_execute(self) -> None:
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
async def async_execute(self) -> None:
def execute(self) -> None:

This task only reset and add elements to a set, that is safe?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It is likely safe, but is less risky to do in the main thread if we can so we don't have to think about if the GIL is making the structure safe or not.

Copy link
Member

Choose a reason for hiding this comment

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

Fair enough 👍

@ludeeus ludeeus merged commit ebcc529 into hacs:main Oct 31, 2021
@github-actions github-actions bot locked and limited conversation to collaborators Nov 1, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants