mirror of
https://github.com/Icinga/icingaweb2-module-director.git
synced 2025-07-24 14:24:42 +02:00
IcingaObjectFieldLoader: return early...
...and save CPU-cycles
This commit is contained in:
parent
6de258730b
commit
220d15c523
@ -240,14 +240,6 @@ class IcingaObjectFieldLoader
|
||||
$kill = array();
|
||||
$columns = array();
|
||||
$object = $this->object;
|
||||
|
||||
$object->invalidateResolveCache();
|
||||
$vars = $object::fromPlainObject(
|
||||
$object->toPlainObject(true),
|
||||
$object->getConnection()
|
||||
)->vars()->flatten();
|
||||
|
||||
$prefixedVars = (object) array();
|
||||
if ($object instanceof IcingaHost) {
|
||||
$prefix = 'host.vars.';
|
||||
} elseif ($object instanceof IcingaService) {
|
||||
@ -256,6 +248,13 @@ class IcingaObjectFieldLoader
|
||||
return $elements;
|
||||
}
|
||||
|
||||
$object->invalidateResolveCache();
|
||||
$vars = $object::fromPlainObject(
|
||||
$object->toPlainObject(true),
|
||||
$object->getConnection()
|
||||
)->vars()->flatten();
|
||||
|
||||
$prefixedVars = (object) array();
|
||||
foreach ($vars as $k => $v) {
|
||||
$prefixedVars->{$prefix . $k} = $v;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user