gcobb321 / icloud3

iCloud3 v3 - iCloud3 is an advanced iDevice tracker that uses Apple iCloud account and HA Companion App data for presence detection and location based automations.
MIT License
498 stars 52 forks source link

Blocking stat() calls in the event loop #347

Open bdraco opened 1 week ago

bdraco commented 1 week ago

https://github.com/gcobb321/icloud3/blob/ed917786755a91478ed973d4ed2ec5503acaaed5/custom_components/icloud3/helpers/common.py#L285 https://github.com/gcobb321/icloud3/blob/ed917786755a91478ed973d4ed2ec5503acaaed5/custom_components/icloud3/helpers/common.py#L302

It looks like there are a few places that will do a blocking stat() syscall in this file.

Home Assistant will be able to detect and warn about these in the future.

https://developers.home-assistant.io/docs/asyncio_blocking_operations#stat

gcobb321 commented 1 week ago

This has been fixed in v3.0.5.2 released a few weeks ago.

bdraco commented 1 week ago

It looks like the open was fixed but the stat call via exists remains

gcobb321 commented 1 week ago

I’ll check that out but wonder why I’m not getting the warning.

bdraco commented 1 week ago

We haven't merged the check for stat calls yet so only open is being checked.

bdraco commented 1 week ago

If you want to check the rest of the code, you can use this branch https://github.com/home-assistant/core/pull/120273