fix(espidf): run library resolution/merge off the event loop

_resolve_library_components does minutes of synchronous filesystem work
for a big library (FastLED: BFS over every header + copying thousands of
files) directly inside async compile(), starving the event loop: the
/api/compile/start response never flushed and clients timed out at 30s
while the build itself was healthy. Run it via asyncio.to_thread like
the cmake and ninja steps already do.
This commit is contained in:
David Montero Crespo 2026-08-19 20:25:01 +02:00
parent 33ee71ef21
commit 13cbcf5ed3
1 changed files with 7 additions and 1 deletions

View File

@ -3668,7 +3668,13 @@ class ESPIDFCompiler:
# / OSS self-host.
arduino_libs = libraries_dir or self._find_arduino_libraries_dir()
component_names, _ = self._resolve_library_components(
# Heavy sync filesystem work (BFS header resolution + copying
# thousands of library files — FastLED alone takes minutes).
# Run it off the event loop like cmake/ninja below, or the
# loop starves: /compile/start responses never flush and the
# client dies on its 30s timeout while the build is fine.
component_names, _ = await asyncio.to_thread(
self._resolve_library_components,
ext_headers, arduino_libs, esp32_libs,
arduino_comp_name, user_libs_dir,
allowed_libraries=allowed_libraries,