Skip to content

Commit

Permalink
Changed check for no nodes in pool
Browse files Browse the repository at this point in the history
  • Loading branch information
lpbeliveau-silabs committed Dec 20, 2023
1 parent ce32d11 commit 977d1df
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/app/reporting/SynchronizedReportSchedulerImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,9 @@ void SynchronizedReportSchedulerImpl::TimerFired()
Timestamp now = mTimerDelegate->GetCurrentMonotonicTimestamp();
bool firedEarly = true;

// If there are no handlers registers, no need to take actions
VerifyOrReturn(mNodesPool.Allocated());

mNodesPool.ForEachActiveObject([now, &firedEarly](ReadHandlerNode * node) {
if (node->GetMinTimestamp() <= now)
{
Expand All @@ -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));
Expand Down

0 comments on commit 977d1df

Please sign in to comment.