mirror of
https://github.com/esphome/esphome.git
synced 2025-08-02 08:27:47 +00:00
make sure no name is nullptr
This commit is contained in:
parent
6d124aa341
commit
99b943004f
@ -255,10 +255,10 @@ void Component::defer(const char *name, std::function<void()> &&f) { // NOLINT
|
|||||||
App.scheduler.set_timeout(this, name, 0, std::move(f));
|
App.scheduler.set_timeout(this, name, 0, std::move(f));
|
||||||
}
|
}
|
||||||
void Component::set_timeout(uint32_t timeout, std::function<void()> &&f) { // NOLINT
|
void Component::set_timeout(uint32_t timeout, std::function<void()> &&f) { // NOLINT
|
||||||
App.scheduler.set_timeout(this, "", timeout, std::move(f));
|
App.scheduler.set_timeout(this, static_cast<const char *>(nullptr), timeout, std::move(f));
|
||||||
}
|
}
|
||||||
void Component::set_interval(uint32_t interval, std::function<void()> &&f) { // NOLINT
|
void Component::set_interval(uint32_t interval, std::function<void()> &&f) { // NOLINT
|
||||||
App.scheduler.set_interval(this, "", interval, std::move(f));
|
App.scheduler.set_interval(this, static_cast<const char *>(nullptr), interval, std::move(f));
|
||||||
}
|
}
|
||||||
void Component::set_retry(uint32_t initial_wait_time, uint8_t max_attempts, std::function<RetryResult(uint8_t)> &&f,
|
void Component::set_retry(uint32_t initial_wait_time, uint8_t max_attempts, std::function<RetryResult(uint8_t)> &&f,
|
||||||
float backoff_increase_factor) { // NOLINT
|
float backoff_increase_factor) { // NOLINT
|
||||||
|
@ -103,13 +103,14 @@ async def test_scheduler_heap_stress(
|
|||||||
|
|
||||||
# Wait for all callbacks to execute (should be quick, but give more time for scheduling)
|
# Wait for all callbacks to execute (should be quick, but give more time for scheduling)
|
||||||
try:
|
try:
|
||||||
await asyncio.wait_for(test_complete_future, timeout=60.0)
|
await asyncio.wait_for(test_complete_future, timeout=10.0)
|
||||||
except TimeoutError:
|
except TimeoutError:
|
||||||
# Report how many we got
|
# Report how many we got
|
||||||
|
missing_ids = sorted(set(range(1000)) - executed_callbacks)
|
||||||
pytest.fail(
|
pytest.fail(
|
||||||
f"Stress test timed out. Only {len(executed_callbacks)} of "
|
f"Stress test timed out. Only {len(executed_callbacks)} of "
|
||||||
f"1000 callbacks executed. Missing IDs: "
|
f"1000 callbacks executed. Missing IDs: "
|
||||||
f"{sorted(set(range(1000)) - executed_callbacks)[:10]}..."
|
f"{missing_ids[:20]}... (total missing: {len(missing_ids)})"
|
||||||
)
|
)
|
||||||
|
|
||||||
# Verify all callbacks executed
|
# Verify all callbacks executed
|
||||||
|
Loading…
x
Reference in New Issue
Block a user