From 4ad4223efaa8d2cc4604f17d2c5822ef08d2070c Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Sun, 11 Oct 2026 08:01:32 -1000 Subject: [PATCH] State the re-arm cost precisely --- AGENTS.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/AGENTS.md b/AGENTS.md index 3a5faa6b886..aaea715d536 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -179,7 +179,7 @@ file does, and it is the authority when they disagree. The most useful starting `set_interval`. Full reasoning, including why `set_interval` costs more below 500 ms: https://developers.esphome.io/architecture/components/advanced/#quick-rule-of-thumb * **Repeating work:** use `set_interval`, never a `set_timeout` that re-arms itself; every re-arm - allocates a new scheduler item. + rebuilds the callback and re-queues a scheduler item, and the period drifts. * **Scheduler ids:** name a timer only when it must be cancelled or replaced, and use a `static constexpr uint32_t` id, never a string. Ids are per component instance and cannot clash with other components, so number them from 0 and keep all of a component's ids together in one place.