From 1cd79d161ec279433ec236f03fece2e05771702d Mon Sep 17 00:00:00 2001 From: James Lucas Date: Thu, 31 Oct 2024 12:56:50 +1100 Subject: [PATCH] Update the event watch list after alarms are called since the state of the matcher may have changed --- src/CorrelationEngine.php | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/src/CorrelationEngine.php b/src/CorrelationEngine.php index 4c11c74..96379b5 100644 --- a/src/CorrelationEngine.php +++ b/src/CorrelationEngine.php @@ -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 */