432 Commits

Author SHA1 Message Date
J. Nick Koston
2c316c5820
Ensure person loads after recorder (#142585)
Co-authored-by: Erik Montnemery <erik@montnemery.com>
2025-04-11 09:39:30 -10:00
Erik Montnemery
1e55d4b613
Restore "Promote after dependencies in bootstrap" (#142001)
Revert "Revert "Promote after dependencies in bootstrap" (#141584)"

This reverts commit de1e06c39bce99f55ea36175e29cc1d76bc35836.
2025-04-04 23:26:43 +02:00
Erik Montnemery
de1e06c39b
Revert "Promote after dependencies in bootstrap" (#141584)
Revert "Promote after dependencies in bootstrap (#140352)"

This reverts commit 376604096049ac2388a1c9d23c578402acbce0b5.
2025-03-27 12:57:58 -04:00
Artur Pragacz
3766040960
Promote after dependencies in bootstrap (#140352) 2025-03-25 11:34:53 +01:00
Artur Pragacz
4f25296c50
Improve dependencies resolution (#138502)
* Improve dependencies resolution

* Improve tests

* Better docstrings

* Fix comment

* Improve tests

* Improve logging

* Address feedback

* Address feedback

* Address feedback

* Address feedback

* Address feedback

* Simplify error handling

* small log change

* Add comment

* Address feedback

* shorter comments

* Add test
2025-03-11 10:12:23 +01:00
Artur Pragacz
2e79db3695
Fix hass stop in bootstrap (#132795) 2025-03-10 21:29:26 -04:00
Erik Montnemery
cc5c8bf5e3
Make helpers.frame.report_usage work when called from any thread (#139836)
* Make helpers.frame.report_usage work when called from any thread

* Address review comments, update tests

* Add test

* Update test

* Update recorder test

* Update tests
2025-03-05 19:37:34 +01:00
andresb5555
7e4432e321
Do not force logfile to roll over when using TimedRotatingFileHandler (#128301)
Do not force log file to roll over when using TimedRotatingFileHandler
2025-03-02 22:07:35 +01:00
Erik Montnemery
bf190a8a73
Add backup helper (#139199)
* Add backup helper

* Add hassio to stage 1

* Apply same changes to newly merged `webdav` and `azure_storage` to fix inflight conflict

* Address comments, add tests

---------

Co-authored-by: J. Nick Koston <nick@koston.org>
2025-02-25 10:19:41 +01:00
Artur Pragacz
d9eb248e91
Better handle runtime recovery mode in bootstrap (#138624)
* Better handle runtime recovery mode in bootstrap

* Add test
2025-02-24 13:23:39 +01:00
J. Nick Koston
bbbad90ca2
Fix race configuring zeroconf (#138425) 2025-02-13 14:17:06 -06:00
Artur Pragacz
7021175e0d
Simplify stage 1 in bootstrap (#137668)
* Simplify stage 1 in bootstrap

* Add timeouts to STAGE 0

* Fix test

* Clarify pre import language

* Remove timeout for frontend and recorder

* Address review

---------

Co-authored-by: J. Nick Koston <nick@koston.org>
2025-02-13 13:07:24 +01:00
Artur Pragacz
ae55e26546
Group helpers of set_up_integrations in bootstrap (#137673) 2025-02-08 10:07:22 +01:00
Jan-Philipp Benecke
889fe05a48
Load hassio before backup at frontend stage (#137067) 2025-02-01 11:43:45 +01:00
Erik Montnemery
64814e086f
Make sure we load the backup integration before frontend (#137010) 2025-01-31 15:50:30 +00:00
J. Nick Koston
d84fa1fcfb
Fix httpx late import of trio doing blocking I/O in the event loop (#136409)
httpx 0.28.1 moved the trio import to happen a bit later

```
2025-01-23 19:53:12.370 WARNING (MainThread) [homeassistant.util.loop] Detected blocking call to open with args (/lib/c, rb) inside the event loop by integration rest at homeassistant/components/rest/data.py, line 88: self._async_client = create_async_httpx_client( (offender: /usr/local/lib/python3.13/ctypes/util.py, line 285: with open(filepath, rb) as fh:), please create a bug report at https://github.com/home-assistant/core/issues?q=is%3Aopen+is%3Aissue+label%3A%22integration%3A+rest%22
For developers, please see https://developers.home-assistant.io/docs/asyncio_blocking_operations/#open
Traceback (most recent call last):
  File "<frozen runpy>", line 198, in _run_module_as_main
  File "<frozen runpy>", line 88, in _run_code
  File "/usr/src/homeassistant/homeassistant/__main__.py", line 227, in <module>
    sys.exit(main())
  File "/usr/src/homeassistant/homeassistant/__main__.py", line 213, in main
    exit_code = runner.run(runtime_conf)
  File "/usr/src/homeassistant/homeassistant/runner.py", line 154, in run
    return loop.run_until_complete(setup_and_run_hass(runtime_config))
  File "/usr/local/lib/python3.13/asyncio/base_events.py", line 707, in run_until_complete
    self.run_forever()
  File "/usr/local/lib/python3.13/asyncio/base_events.py", line 678, in run_forever
    self._run_once()
  File "/usr/local/lib/python3.13/asyncio/base_events.py", line 2033, in _run_once
    handle._run()
  File "/usr/local/lib/python3.13/asyncio/events.py", line 89, in _run
    self._context.run(self._callback, *self._args)
  File "/usr/src/homeassistant/homeassistant/config_entries.py", line 2360, in _async_forward_entry_setup
    result = await async_setup_component(
  File "/usr/src/homeassistant/homeassistant/setup.py", line 165, in async_setup_component
    result = await _async_setup_component(hass, domain, config)
  File "/usr/src/homeassistant/homeassistant/setup.py", line 420, in _async_setup_component
    result = await task
  File "/usr/src/homeassistant/homeassistant/components/sensor/__init__.py", line 90, in async_setup
    await component.async_setup(config)
  File "/usr/src/homeassistant/homeassistant/helpers/entity_component.py", line 146, in async_setup
    self.hass.async_create_task_internal(
  File "/usr/src/homeassistant/homeassistant/core.py", line 832, in async_create_task_internal
    task = create_eager_task(target, name=name, loop=self.loop)
  File "/usr/src/homeassistant/homeassistant/util/async_.py", line 45, in create_eager_task
    return Task(coro, loop=loop, name=name, eager_start=True)
  File "/usr/src/homeassistant/homeassistant/helpers/entity_component.py", line 307, in async_setup_platform
    await self._platforms[key].async_setup(platform_config, discovery_info)
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 303, in async_setup
    await self._async_setup_platform(async_create_setup_awaitable)
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 363, in _async_setup_platform
    awaitable = create_eager_task(awaitable, loop=hass.loop)
  File "/usr/src/homeassistant/homeassistant/util/async_.py", line 45, in create_eager_task
    return Task(coro, loop=loop, name=name, eager_start=True)
  File "/usr/src/homeassistant/homeassistant/components/rest/sensor.py", line 85, in async_setup_platform
    await rest.async_update(log_errors=False)
  File "/usr/src/homeassistant/homeassistant/components/rest/data.py", line 88, in async_update
    self._async_client = create_async_httpx_client(

2025-01-23 19:53:12.371 WARNING (MainThread) [homeassistant.util.loop] Detected blocking call to glob with args (/lib/libc.so,) inside the event loop by integration rest at homeassistant/components/rest/data.py, line 88: self._async_client = create_async_httpx_client( (offender: /usr/local/lib/python3.13/ctypes/util.py, line 311: for f in glob({0}{1}.format(prefix, suffix)):), please create a bug report at https://github.com/home-assistant/core/issues?q=is%3Aopen+is%3Aissue+label%3A%22integration%3A+rest%22
For developers, please see https://developers.home-assistant.io/docs/asyncio_blocking_operations/#glob
Traceback (most recent call last):
  File "<frozen runpy>", line 198, in _run_module_as_main
  File "<frozen runpy>", line 88, in _run_code
  File "/usr/src/homeassistant/homeassistant/__main__.py", line 227, in <module>
    sys.exit(main())
  File "/usr/src/homeassistant/homeassistant/__main__.py", line 213, in main
    exit_code = runner.run(runtime_conf)
  File "/usr/src/homeassistant/homeassistant/runner.py", line 154, in run
    return loop.run_until_complete(setup_and_run_hass(runtime_config))
  File "/usr/local/lib/python3.13/asyncio/base_events.py", line 707, in run_until_complete
    self.run_forever()
  File "/usr/local/lib/python3.13/asyncio/base_events.py", line 678, in run_forever
    self._run_once()
  File "/usr/local/lib/python3.13/asyncio/base_events.py", line 2033, in _run_once
    handle._run()
  File "/usr/local/lib/python3.13/asyncio/events.py", line 89, in _run
    self._context.run(self._callback, *self._args)
  File "/usr/src/homeassistant/homeassistant/config_entries.py", line 2360, in _async_forward_entry_setup
    result = await async_setup_component(
  File "/usr/src/homeassistant/homeassistant/setup.py", line 165, in async_setup_component
    result = await _async_setup_component(hass, domain, config)
  File "/usr/src/homeassistant/homeassistant/setup.py", line 420, in _async_setup_component
    result = await task
  File "/usr/src/homeassistant/homeassistant/components/sensor/__init__.py", line 90, in async_setup
    await component.async_setup(config)
  File "/usr/src/homeassistant/homeassistant/helpers/entity_component.py", line 146, in async_setup
    self.hass.async_create_task_internal(
  File "/usr/src/homeassistant/homeassistant/core.py", line 832, in async_create_task_internal
    task = create_eager_task(target, name=name, loop=self.loop)
  File "/usr/src/homeassistant/homeassistant/util/async_.py", line 45, in create_eager_task
    return Task(coro, loop=loop, name=name, eager_start=True)
  File "/usr/src/homeassistant/homeassistant/helpers/entity_component.py", line 307, in async_setup_platform
    await self._platforms[key].async_setup(platform_config, discovery_info)
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 303, in async_setup
    await self._async_setup_platform(async_create_setup_awaitable)
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 363, in _async_setup_platform
    awaitable = create_eager_task(awaitable, loop=hass.loop)
  File "/usr/src/homeassistant/homeassistant/util/async_.py", line 45, in create_eager_task
    return Task(coro, loop=loop, name=name, eager_start=True)
  File "/usr/src/homeassistant/homeassistant/components/rest/sensor.py", line 85, in async_setup_platform
    await rest.async_update(log_errors=False)
  File "/usr/src/homeassistant/homeassistant/components/rest/data.py", line 88, in async_update
    self._async_client = create_async_httpx_client(

2025-01-23 19:53:12.372 WARNING (MainThread) [homeassistant.util.loop] Detected blocking call to iglob with args (/lib/libc.so,) inside the event loop by integration rest at homeassistant/components/rest/data.py, line 88: self._async_client = create_async_httpx_client( (offender: /usr/local/lib/python3.13/glob.py, line 31: return list(iglob(pathname, root_dir=root_dir, dir_fd=dir_fd, recursive=recursive,), please create a bug report at https://github.com/home-assistant/core/issues?q=is%3Aopen+is%3Aissue+label%3A%22integration%3A+rest%22
For developers, please see https://developers.home-assistant.io/docs/asyncio_blocking_operations/#iglob
Traceback (most recent call last):
  File "<frozen runpy>", line 198, in _run_module_as_main
  File "<frozen runpy>", line 88, in _run_code
  File "/usr/src/homeassistant/homeassistant/__main__.py", line 227, in <module>
    sys.exit(main())
  File "/usr/src/homeassistant/homeassistant/__main__.py", line 213, in main
    exit_code = runner.run(runtime_conf)
  File "/usr/src/homeassistant/homeassistant/runner.py", line 154, in run
    return loop.run_until_complete(setup_and_run_hass(runtime_config))
  File "/usr/local/lib/python3.13/asyncio/base_events.py", line 707, in run_until_complete
    self.run_forever()
  File "/usr/local/lib/python3.13/asyncio/base_events.py", line 678, in run_forever
    self._run_once()
  File "/usr/local/lib/python3.13/asyncio/base_events.py", line 2033, in _run_once
    handle._run()
  File "/usr/local/lib/python3.13/asyncio/events.py", line 89, in _run
    self._context.run(self._callback, *self._args)
  File "/usr/src/homeassistant/homeassistant/config_entries.py", line 2360, in _async_forward_entry_setup
    result = await async_setup_component(
  File "/usr/src/homeassistant/homeassistant/setup.py", line 165, in async_setup_component
    result = await _async_setup_component(hass, domain, config)
  File "/usr/src/homeassistant/homeassistant/setup.py", line 420, in _async_setup_component
    result = await task
  File "/usr/src/homeassistant/homeassistant/components/sensor/__init__.py", line 90, in async_setup
    await component.async_setup(config)
  File "/usr/src/homeassistant/homeassistant/helpers/entity_component.py", line 146, in async_setup
    self.hass.async_create_task_internal(
  File "/usr/src/homeassistant/homeassistant/core.py", line 832, in async_create_task_internal
    task = create_eager_task(target, name=name, loop=self.loop)
  File "/usr/src/homeassistant/homeassistant/util/async_.py", line 45, in create_eager_task
    return Task(coro, loop=loop, name=name, eager_start=True)
  File "/usr/src/homeassistant/homeassistant/helpers/entity_component.py", line 307, in async_setup_platform
    await self._platforms[key].async_setup(platform_config, discovery_info)
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 303, in async_setup
    await self._async_setup_platform(async_create_setup_awaitable)
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 363, in _async_setup_platform
    awaitable = create_eager_task(awaitable, loop=hass.loop)
  File "/usr/src/homeassistant/homeassistant/util/async_.py", line 45, in create_eager_task
    return Task(coro, loop=loop, name=name, eager_start=True)
  File "/usr/src/homeassistant/homeassistant/components/rest/sensor.py", line 85, in async_setup_platform
    await rest.async_update(log_errors=False)
  File "/usr/src/homeassistant/homeassistant/components/rest/data.py", line 88, in async_update
    self._async_client = create_async_httpx_client(

2025-01-23 19:53:12.374 WARNING (MainThread) [homeassistant.util.loop] Detected blocking call to scandir with args (/lib,) inside the event loop by integration rest at homeassistant/components/rest/data.py, line 88: self._async_client = create_async_httpx_client( (offender: /usr/local/lib/python3.13/glob.py, line 170: with os.scandir(arg) as it:), please create a bug report at https://github.com/home-assistant/core/issues?q=is%3Aopen+is%3Aissue+label%3A%22integration%3A+rest%22
For developers, please see https://developers.home-assistant.io/docs/asyncio_blocking_operations/#scandir
Traceback (most recent call last):
  File "<frozen runpy>", line 198, in _run_module_as_main
  File "<frozen runpy>", line 88, in _run_code
  File "/usr/src/homeassistant/homeassistant/__main__.py", line 227, in <module>
    sys.exit(main())
  File "/usr/src/homeassistant/homeassistant/__main__.py", line 213, in main
    exit_code = runner.run(runtime_conf)
  File "/usr/src/homeassistant/homeassistant/runner.py", line 154, in run
    return loop.run_until_complete(setup_and_run_hass(runtime_config))
  File "/usr/local/lib/python3.13/asyncio/base_events.py", line 707, in run_until_complete
    self.run_forever()
  File "/usr/local/lib/python3.13/asyncio/base_events.py", line 678, in run_forever
    self._run_once()
  File "/usr/local/lib/python3.13/asyncio/base_events.py", line 2033, in _run_once
    handle._run()
  File "/usr/local/lib/python3.13/asyncio/events.py", line 89, in _run
    self._context.run(self._callback, *self._args)
  File "/usr/src/homeassistant/homeassistant/config_entries.py", line 2360, in _async_forward_entry_setup
    result = await async_setup_component(
  File "/usr/src/homeassistant/homeassistant/setup.py", line 165, in async_setup_component
    result = await _async_setup_component(hass, domain, config)
  File "/usr/src/homeassistant/homeassistant/setup.py", line 420, in _async_setup_component
    result = await task
  File "/usr/src/homeassistant/homeassistant/components/sensor/__init__.py", line 90, in async_setup
    await component.async_setup(config)
  File "/usr/src/homeassistant/homeassistant/helpers/entity_component.py", line 146, in async_setup
    self.hass.async_create_task_internal(
  File "/usr/src/homeassistant/homeassistant/core.py", line 832, in async_create_task_internal
    task = create_eager_task(target, name=name, loop=self.loop)
  File "/usr/src/homeassistant/homeassistant/util/async_.py", line 45, in create_eager_task
    return Task(coro, loop=loop, name=name, eager_start=True)
  File "/usr/src/homeassistant/homeassistant/helpers/entity_component.py", line 307, in async_setup_platform
    await self._platforms[key].async_setup(platform_config, discovery_info)
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 303, in async_setup
    await self._async_setup_platform(async_create_setup_awaitable)
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 363, in _async_setup_platform
    awaitable = create_eager_task(awaitable, loop=hass.loop)
  File "/usr/src/homeassistant/homeassistant/util/async_.py", line 45, in create_eager_task
    return Task(coro, loop=loop, name=name, eager_start=True)
  File "/usr/src/homeassistant/homeassistant/components/rest/sensor.py", line 85, in async_setup_platform
    await rest.async_update(log_errors=False)
  File "/usr/src/homeassistant/homeassistant/components/rest/data.py", line 88, in async_update
    self._async_client = create_async_httpx_client(
```
2025-01-25 09:15:05 +01:00
Craig Andrews
9e8df72c0d
Improve is docker env checks (#132404)
Co-authored-by: Franck Nijhof <frenck@frenck.nl>
Co-authored-by: Sander Hoentjen <sander@hoentjen.eu>
Co-authored-by: Paulus Schoutsen <paulus@home-assistant.io>
Co-authored-by: Robert Resch <robert@resch.dev>
2025-01-02 17:21:49 +01:00
J. Nick Koston
de1b6a0dfc
Add backup to the list of storage preloads (#133855) 2024-12-22 23:17:13 -05:00
Robert Resch
cd12720085
Add Python version to issue ID (#130611) 2024-11-14 16:31:33 +01:00
Erik Montnemery
3e62c6ae2f
Move core config functionality to its own module (#129065)
* Move core config functionality to its own module

* Adjust test
2024-10-24 13:34:51 +02:00
Artur Pragacz
67e3139dcf
Clean up useless logging handler setting (#120974)
Setting level of the handler does effectively nothing,
because HomeAssistantQueueHandler ignores this setting.
Also make the convention of getting the root logger uniform.
2024-08-05 11:22:13 +02:00
Erik Montnemery
3df6b34a03
Split recorder and frontend bootstrap steps (#122420) 2024-07-22 23:07:49 +02:00
Erik Montnemery
c73e7ae178
Handle integration with missing dependencies (#122386) 2024-07-22 15:41:55 +02:00
J. Nick Koston
adee8094e7
Cache is_official_image/is_docker_env in bootstrap to fix blocking I/O (#121261)
* Cache is_official_image and is_docker_env in bootstrap to fix blocking I/O

These do blocking I/O later in the startup process

discovered in https://github.com/home-assistant/core/pull/120273

* comment
2024-07-05 08:30:07 +02:00
Erik Montnemery
b8b7c23258
Create log files in an executor thread (#120912) 2024-07-02 15:48:35 +02:00
Erik Montnemery
7d14b9c5c8
Always create a new HomeAssistant object when falling back to recovery mode (#119969) 2024-06-19 22:45:59 +02:00
J. Nick Koston
6ba8b7a5d6
Remove isal from after_dependencies in http (#119000) 2024-06-07 09:21:53 +02:00
Erik Montnemery
f896c7505b
Improve async_get_issue_tracker for custom integrations (#118016) 2024-05-24 09:55:05 +02:00
J. Nick Koston
e12d23bd48
Speed up async_get_loaded_integrations (#117851)
* Speed up async_get_loaded_integrations

Use a setcomp and difference to find the components to split
to avoid the loop. A setcomp is inlined in python3.12 so its
much faster

* Speed up async_get_loaded_integrations

Use a setcomp and difference to find the components to split
to avoid the loop. A setcomp is inlined in python3.12 so its
much faster

* simplify

* fix compat

* bootstrap

* fix tests
2024-05-21 09:08:49 -04:00
J. Nick Koston
437fe3fa4e
Fix mimetypes doing blocking I/O in the event loop (#117292)
The first time aiohttp calls mimetypes, it will load the mime.types file

We now init the db in the executor to avoid blocking the event loop
2024-05-12 10:47:52 +02:00
J. Nick Koston
b061e7d1aa
Small speed up to setting up integrations and config entries (#117278)
* Small speed up to setting up integration and config entries

When profiling tests, I noticed many calls to get_running_loop. In the places
where we are already in a coro, pass the existing loop so it does not have to
be looked up. I did not do this for places were we are not in a coro since there
is risk that an integration could be doing a non-thread-safe call and its better
that the code raises when trying to fetch the running loop vs the performance
improvement for these cases.

* fix merge

* missed some
2024-05-11 22:39:20 -04:00
Marc Mueller
c50a340cbc
Use HassKey for setup and bootstrap (#116998) 2024-05-07 11:18:20 -05:00
Sid
b456d97e65
Replace pylint protected-access with Ruff SLF001 (#115735) 2024-05-06 20:33:26 +02:00
J. Nick Koston
91fa8b50cc
Turn on thread safety checks in async_dispatcher_send (#116867)
* Turn on thread safety checks in async_dispatcher_send

We keep seeing issues where async_dispatcher_send is called from
a thread which means we call the callback function on the other
side in the thread as well which usually leads to a crash

* Turn on thread safety checks in async_dispatcher_send

We keep seeing issues where async_dispatcher_send is called from
a thread which means we call the callback function on the other
side in the thread as well which usually leads to a crash

* adjust
2024-05-05 16:29:43 -04:00
J. Nick Koston
164403de20
Add thread safety checks to async_create_task (#116339)
* Add thread safety checks to async_create_task

Calling async_create_task from a thread almost always results in an
fast crash. Since most internals are using async_create_background_task
or other task APIs, and this is the one integrations seem to get wrong
the most, add a thread safety check here

* Add thread safety checks to async_create_task

Calling async_create_task from a thread almost always results in an
fast crash. Since most internals are using async_create_background_task
or other task APIs, and this is the one integrations seem to get wrong
the most, add a thread safety check here

* missed one

* Update homeassistant/core.py

* fix mocks

* one more internal

* more places where internal can be used

* more places where internal can be used

* more places where internal can be used

* internal one more place since this is high volume and was already eager_start
2024-04-28 18:29:00 -04:00
J. Nick Koston
ab2ea6100c
Speed up singleton decorator so it can be used more places (#116292) 2024-04-28 12:11:08 -05:00
J. Nick Koston
d17e9bfc99
Enable debug mode if asyncio debug is on at startup (#116084) 2024-04-24 12:55:09 +02:00
J. Nick Koston
53a179088f
Add debug mode to catch unsafe thread operations using core helpers (#115390)
* adjust

* adjust

* fixes

* one more

* test

* debug

* move to config

* cover

* Update homeassistant/core.py

* set debug from RuntimeConfig

* reduce

* fix message

* raise

* Update homeassistant/core.py

* Update homeassistant/core.py

* no flood check for raise

* cover
2024-04-24 03:36:05 +02:00
J. Nick Koston
bf5cf382dc
Avoid useless stat() syscalls for every logger record (#114987)
* Avoid useless stat() syscalls for every logger record

shouldRollover will always return False since we do
not use maxBytes as we are only using RotatingFileHandler
for the backupCount option. Since every log record will
stat the log file to see if it exists and if its a normal
file, we can override the shouldRollover to reduce the
logging overhead quite a bit

1d3225ae05/Lib/logging/handlers.py (L189)

* assert False is False
2024-04-05 22:00:09 -04:00
J. Nick Koston
0c3ccabfb1
Speed up logger setup (#114610)
* Speed up logger setup

Preload core.logger and avoid saving it
until after startup

* add comment about 180s

* Adjust grammar

---------

Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
2024-04-04 08:35:44 +02:00
J. Nick Koston
5038a035bd
Detect blocking module imports in the event loop (#114488) 2024-03-30 19:51:31 -10:00
J. Nick Koston
ef5f6829e7
Fix late load of anyio doing blocking I/O in the event loop (#114491)
* Fix late load of anyio doing blocking I/O in the event loop

httpx loads anyio which loads the asyncio backend in the event loop
as soon as httpx makes the first request

* tweak
2024-03-30 14:56:01 -04:00
J. Nick Koston
cabc4f797a
Preload storage for integrations we know we are going to setup (#114192) 2024-03-25 15:49:54 -10:00
J. Nick Koston
e8cb6a8e29
Optimize loading of translations (#114089) 2024-03-23 22:22:09 -10:00
J. Nick Koston
31fb02a71d
Fix after deps not being considered for integrations before stage 1 (#114045) 2024-03-23 11:21:56 +01:00
J. Nick Koston
952f47ab18
Combine recorder and frontend bootstrap step (#113985) 2024-03-22 13:50:39 -10:00
J. Nick Koston
7758f41c5a
Load system info with base functionality (#113923) 2024-03-21 09:24:39 +01:00
J. Nick Koston
c615b52840
Refactor integration startup time to show wall clock time (#113707)
* Refactor setup time tracking to exclude time waiting on other operations

We now exclude the import time and th time waiting on
base platforms to setup from the setup times

* tweak

* tweak

* tweak

* tweak

* adjust

* fixes

* fixes

* preen

* preen

* tweak

* tweak

* adjust

* tweak

* reduce

* do not count integrtion platforms against their parent integration

* handle legacy tts platforms

* stt as well

* one more wait

* use the same pattern in all the legacy

* fix tts and stt legacy

* fix

* fix

* reduce

* preen

* entity comp does not wait for platforms

* scene blocks as well

* fix test

* test fixes

* coverage

* coverage

* coverage

* fix test

* Update tests/test_setup.py

Co-authored-by: Martin Hjelmare <marhje52@gmail.com>

* Update tests/test_setup.py

Co-authored-by: Martin Hjelmare <marhje52@gmail.com>

* Update homeassistant/setup.py

Co-authored-by: Martin Hjelmare <marhje52@gmail.com>

* strip

* strip WAIT_PLATFORM_INTEGRATION

* strip WAIT_PLATFORM_INTEGRATION

* strip WAIT_PLATFORM_INTEGRATION

* strip WAIT_PLATFORM_INTEGRATION

* remove complexity

* Apply suggestions from code review

* no longer works that way

* fixes

* fixes

* fixes

---------

Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
2024-03-18 21:45:34 -04:00
Sid
6113b99ddd
Replace pylint pointless-statement with ruff B018 (#113582)
* Replace pylint pointless-statement with ruff B018

* fix occurrences of B018

* disable pylint expression-not-assigned as well

---------

Co-authored-by: J. Nick Koston <nick@koston.org>
2024-03-17 10:58:14 +01:00
J. Nick Koston
eb90c9a548
Reduce bottlenecks in bootstrap by ordering the setup of integrations (#113570) 2024-03-15 22:38:06 -10:00