IcingaObjectGroup: membership calculation...
...is now being triggered only when assign_filter exists / has been changed fixes #2048
This commit is contained in:
parent
4ddf4112b1
commit
48af679cf0
|
@ -34,6 +34,10 @@ This version hasn't been released yet
|
|||
### Health Check
|
||||
* FIX: complaint about overdue jobs was not correct (#2680, #2681)
|
||||
|
||||
### Internals
|
||||
|
||||
* FIX: group membership is no longer resolved when not needed (#2048)
|
||||
|
||||
### Fixed issues
|
||||
* You can find issues and feature requests related to this release on our
|
||||
[roadmap](https://github.com/Icinga/icingaweb2-module-director/milestone/33?closed=1)
|
||||
|
|
|
@ -31,12 +31,8 @@ class IcingaHostGroup extends IcingaObjectGroup
|
|||
return $this;
|
||||
}
|
||||
|
||||
protected function notifyResolvers()
|
||||
protected function getMemberShipResolver()
|
||||
{
|
||||
$resolver = $this->getHostGroupMembershipResolver();
|
||||
$resolver->addGroup($this);
|
||||
$resolver->refreshDb();
|
||||
|
||||
return $this;
|
||||
return $this->getHostGroupMembershipResolver();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -31,4 +31,35 @@ abstract class IcingaObjectGroup extends IcingaObject implements ExportInterface
|
|||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
protected function memberShipShouldBeRefreshed(): bool
|
||||
{
|
||||
if ($this->hasBeenLoadedFromDb()) {
|
||||
if (!array_key_exists('assign_filter', $this->getModifiedProperties())) {
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
if ($this->get('assign_filter') === null) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
protected function notifyResolvers()
|
||||
{
|
||||
if ($this->memberShipShouldBeRefreshed()) {
|
||||
$resolver = $this->getMemberShipResolver();
|
||||
$resolver->addGroup($this);
|
||||
$resolver->refreshDb();
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
protected function getMemberShipResolver()
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -31,12 +31,8 @@ class IcingaServiceGroup extends IcingaObjectGroup
|
|||
return $this;
|
||||
}
|
||||
|
||||
protected function notifyResolvers()
|
||||
protected function getMemberShipResolver()
|
||||
{
|
||||
$resolver = $this->getServiceGroupMembershipResolver();
|
||||
$resolver->addGroup($this);
|
||||
$resolver->refreshDb();
|
||||
|
||||
return $this;
|
||||
return $this->getServiceGroupMembershipResolver();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue