Skip to content

Commit

Permalink
Update the event watch list after alarms are called since the state o…
Browse files Browse the repository at this point in the history
…f the matcher may have changed
  • Loading branch information
lucasnetau committed Oct 31, 2024
1 parent e4bec06 commit 1cd79d1
Showing 1 changed file with 6 additions and 9 deletions.
15 changes: 6 additions & 9 deletions src/CorrelationEngine.php
Original file line number Diff line number Diff line change
Expand Up @@ -499,26 +499,23 @@ public function checkTimeouts(DateTimeInterface $time): int
*/
$matcher = $timeout['matcher'];
$matcher->alarm();
$matcher->fire();
$matcher->fire(); //@TODO check if only want to do this when it is timed out
$triggered++;
if ($matcher->isTimedOut())
{
$this->clearWatchForEvents($matcher);
if ($matcher->isTimedOut()) {
/** Remove all references if the matcher is timed out */
$this->removeTimeout($matcher);
/** Record stat of matcher timeout */
$this->incrStat('matcher_timeout', get_class($matcher));
$this->removeMatcher($matcher);
unset($matcher);
}
else
{
} else {
/** Update the timeout for this matcher after it has alarmed but has not timed out */
$this->addTimeout($matcher);
$this->addWatchForEvents($matcher, $matcher->nextAcceptedEvents());
}
$this->dirty = true;
}
else
{
} else {
/**
* Timeouts are sorted so if current event is before timeout then return early
*/
Expand Down

0 comments on commit 1cd79d1

Please sign in to comment.