mirror of
https://github.com/Icinga/icingaweb2-module-director.git
synced 2026-06-08 16:24:21 -04:00
Merge pull request #1836 from Icinga/bugfix/clear-prefetch
Avoid caching between multiple runs of sync
This commit is contained in:
commit
d3fa347ec2
2 changed files with 6 additions and 0 deletions
|
|
@ -3,6 +3,7 @@
|
|||
namespace Icinga\Module\Director\Db\Cache;
|
||||
|
||||
use Icinga\Module\Director\CustomVariable\CustomVariable;
|
||||
use Icinga\Module\Director\Data\Db\DbObject;
|
||||
use Icinga\Module\Director\Db;
|
||||
use Icinga\Module\Director\Objects\IcingaObject;
|
||||
use Icinga\Module\Director\Resolver\HostServiceBlacklist;
|
||||
|
|
@ -36,6 +37,7 @@ class PrefetchCache
|
|||
|
||||
public static function initialize(Db $db)
|
||||
{
|
||||
self::forget();
|
||||
self::$instance = new static($db);
|
||||
}
|
||||
|
||||
|
|
@ -60,6 +62,7 @@ class PrefetchCache
|
|||
|
||||
public static function forget()
|
||||
{
|
||||
DbObject::clearAllPrefetchCaches();
|
||||
self::$instance = null;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -19,6 +19,7 @@ use Icinga\Module\Director\Objects\SyncProperty;
|
|||
use Icinga\Module\Director\Objects\SyncRule;
|
||||
use Icinga\Module\Director\Objects\SyncRun;
|
||||
use Icinga\Exception\IcingaException;
|
||||
use Icinga\Module\Director\Repository\IcingaTemplateRepository;
|
||||
use InvalidArgumentException;
|
||||
|
||||
class Sync
|
||||
|
|
@ -811,6 +812,8 @@ class Sync
|
|||
protected function prepareCache()
|
||||
{
|
||||
PrefetchCache::initialize($this->db);
|
||||
IcingaTemplateRepository::clear();
|
||||
|
||||
$ruleObjectType = $this->rule->get('object_type');
|
||||
|
||||
$dummy = IcingaObject::createByType($ruleObjectType);
|
||||
|
|
|
|||
Loading…
Reference in a new issue