From a2fbe9137c165dc4cf2c53c988ef7b57b7fd8264 Mon Sep 17 00:00:00 2001 From: lpbeliveau-silabs <112982107+lpbeliveau-silabs@users.noreply.github.com> Date: Wed, 20 Dec 2023 19:02:36 -0500 Subject: [PATCH] [Report Scheduler] Empty node pool handling (#31136) * Changed check for no nodes in pool * Update src/app/reporting/SynchronizedReportSchedulerImpl.cpp Co-authored-by: Boris Zbarsky --------- Co-authored-by: Boris Zbarsky --- src/app/reporting/SynchronizedReportSchedulerImpl.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/app/reporting/SynchronizedReportSchedulerImpl.cpp b/src/app/reporting/SynchronizedReportSchedulerImpl.cpp index 6627cf7116bec3..7dfa84c70e5343 100644 --- a/src/app/reporting/SynchronizedReportSchedulerImpl.cpp +++ b/src/app/reporting/SynchronizedReportSchedulerImpl.cpp @@ -182,6 +182,9 @@ void SynchronizedReportSchedulerImpl::TimerFired() Timestamp now = mTimerDelegate->GetCurrentMonotonicTimestamp(); bool firedEarly = true; + // If there are no handlers registered, no need to do anything. + VerifyOrReturn(mNodesPool.Allocated()); + mNodesPool.ForEachActiveObject([now, &firedEarly](ReadHandlerNode * node) { if (node->GetMinTimestamp() <= now) { @@ -201,8 +204,7 @@ void SynchronizedReportSchedulerImpl::TimerFired() return Loop::Continue; }); - // If there are no handlers registers, no need to schedule the next report - if (mNodesPool.Allocated() && firedEarly) + if (firedEarly) { Timeout timeout = Milliseconds32(0); ReturnOnFailure(CalculateNextReportTimeout(timeout, nullptr, now));