Files
esphome/tests/integration/fixtures/scheduler_delay_runs_on_failed_component.yaml
J. Nick Koston 3a4f67def8 [core] Fix delay on failed component being dropped; DRY the is_failed check
The is_failed() skip exists in two execution paths: the heap loop in call()
and should_skip_item_() (defer queue / delay:0). The previous commit only
exempted SELF_POINTER items from the heap-path check, so on multi-threaded
platforms a delay:0 continuation whose host component had failed would still
be silently dropped.

Extract a single is_item_failed_() helper (with the SELF_POINTER exemption)
and use it from both paths so they cannot drift again.

Add an integration test that schedules a delay from a component that marks
itself failed and asserts the continuation still fires (verified to fail
without the exemption).
2026-06-02 13:54:17 -05:00

33 lines
860 B
YAML

esphome:
name: scheduler-delay-failed
host:
api:
logger:
level: DEBUG
globals:
- id: started
type: bool
restore_value: false
initial_value: "false"
# The interval fires with itself as the current component, schedules a delay (which
# captures that component for log attribution), then marks itself failed. The delay
# continuation must still fire: a failed component must not drop an already-scheduled
# delay, because the SELF_POINTER scheduler item stores the component for attribution
# only.
interval:
- interval: 100ms
id: host_interval
then:
- if:
condition:
lambda: "return !id(started);"
then:
- lambda: |-
id(started) = true;
id(host_interval)->mark_failed();
- delay: 200ms
- logger.log: "DELAY_FIRED_AFTER_FAIL"