Sync: Make sure to prefetch relations for objects

This can avoid a lot of queries for zones, commands, timeperiods.
This commit is contained in:
Markus Frosch 2018-03-11 13:08:16 +01:00 committed by Thomas Gelf
parent c4a95fd64e
commit 3b812fab7d

View File

@ -585,9 +585,8 @@ class Sync
return $this->objects;
}
PrefetchCache::initialize($this->db);
$this->raiseLimits()
->prepareCache()
->startMeasurements()
->fetchSyncProperties()
->prepareRelatedImportSources()
@ -753,4 +752,13 @@ class Sync
return $this->run->id;
}
protected function prepareCache()
{
PrefetchCache::initialize($this->db);
IcingaObject::prefetchAllRelationsByType($this->rule->object_type, $this->db);
return $this;
}
}