[icinga-checkins] icinga.org: icingaweb2-module-director/bugfix/loop-templateresolver-11803: WIP: IcingaObject: Do not invalidate templateResolver on every setImports ()

git at icinga.org git at icinga.org
Wed Oct 26 16:16:03 CEST 2016


Module: icingaweb2-module-director
Branch: bugfix/loop-templateresolver-11803
Commit: 51a745e0a9f042223852822e2f417a75a0df9ba8
URL:    https://git.icinga.org/?p=icingaweb2-module-director.git;a=commit;h=51a745e0a9f042223852822e2f417a75a0df9ba8

Author: Markus Frosch <markus.frosch at icinga.com>
Date:   Wed Oct 26 16:15:57 2016 +0200

WIP: IcingaObject: Do not invalidate templateResolver on every setImports()

This probably breaks loop detection again. But clearing the cache hard every time, will extremely slow down sync.

refs #11803

---

 library/Director/Objects/IcingaObject.php |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/library/Director/Objects/IcingaObject.php b/library/Director/Objects/IcingaObject.php
index 438eceb..73bcbc0 100644
--- a/library/Director/Objects/IcingaObject.php
+++ b/library/Director/Objects/IcingaObject.php
@@ -783,7 +783,7 @@ abstract class IcingaObject extends DbObject implements IcingaConfigRenderer
         }
 
         if ($this->imports()->hasBeenModified()) {
-            $this->invalidateResolveCache();
+            $this->invalidateResolveCache(false);
         }
     }
 
@@ -997,10 +997,10 @@ abstract class IcingaObject extends DbObject implements IcingaConfigRenderer
         $this->resolveCache[$what] = $vals;
     }
 
-    public function invalidateResolveCache()
+    public function invalidateResolveCache($forTemplates = true)
     {
         $this->resolveCache = array();
-        if ($this->templateResolver) {
+        if ($forTemplates === true && $this->templateResolver) {
             $this->templateResolver()->clearCache();
         }
 



More information about the icinga-checkins mailing list