mirror of
https://github.com/esphome/esphome.git
synced 2026-10-07 03:16:37 +00:00
[web_server_idf] Build state documents in a stack arena so a state event does no heap allocation (#19383)
This commit is contained in:
@@ -1,3 +1,6 @@
|
||||
import functools
|
||||
|
||||
from esphome.components.json import enable_arena
|
||||
from tests.testing_helpers import ComponentManifestOverride
|
||||
|
||||
|
||||
@@ -7,3 +10,12 @@ def override_manifest(manifest: ComponentManifestOverride) -> None:
|
||||
# library registration to happen, otherwise json_util.cpp fails to find
|
||||
# ArduinoJson.h.
|
||||
manifest.enable_codegen()
|
||||
# The JsonArena host test needs the arena compiled in, as a consumer would request it
|
||||
real_to_code = manifest.to_code
|
||||
|
||||
@functools.wraps(real_to_code)
|
||||
async def to_code_with_arena(config):
|
||||
await real_to_code(config)
|
||||
enable_arena()
|
||||
|
||||
manifest.to_code = to_code_with_arena
|
||||
|
||||
Reference in New Issue
Block a user