icingadb-web/library/Icingadb/Model/UnreachableParent/ResultSet.php
Johannes Meyer e5b499bbdb UnreachableParent: Eliminate duplicate nodes
Nodes might be referenced by multiple independent paths, which
might lead to the same root problem multiple times.
2025-01-15 16:39:50 +01:00

23 lines
501 B
PHP

<?php
namespace Icinga\Module\Icingadb\Model\UnreachableParent;
use Icinga\Module\Icingadb\Redis\VolatileStateResults;
use Traversable;
class ResultSet extends VolatileStateResults
{
protected function yieldTraversable(Traversable $traversable)
{
$knownIds = [];
foreach ($traversable as $value) {
if (isset($knownIds[$value->id])) {
continue;
}
$knownIds[$value->id] = true;
yield $value;
}
}
}