Skip to content

Commit

Permalink
[Report Scheduler] Empty node pool handling (#31136)
Browse files Browse the repository at this point in the history
* Changed check for no nodes in pool

* Update src/app/reporting/SynchronizedReportSchedulerImpl.cpp

Co-authored-by: Boris Zbarsky <[email protected]>

---------

Co-authored-by: Boris Zbarsky <[email protected]>
  • Loading branch information
lpbeliveau-silabs and bzbarsky-apple authored Dec 21, 2023
1 parent 2544b6e commit bd24a65
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 registered, no need to do anything.
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 bd24a65

Please sign in to comment.