Просмотр исходного кода

#2687 ElasticSearch: indexing using too much memory

Alex Trofimov 6 лет назад
Родитель
Сommit
0b009a3fdc

+ 7 - 1
inc/classes/BxDolContentInfo.php

@@ -36,6 +36,7 @@ class BxDolContentInfo extends BxDolFactory implements iBxDolFactoryObject
     protected $_sSystem;
     protected $_aSystem;
     protected $_aGrid;
+    protected $_bIgnoreCacheInServiceCalls = false;
 
     protected function __construct($sSystem)
     {
@@ -216,6 +217,11 @@ class BxDolContentInfo extends BxDolFactory implements iBxDolFactoryObject
         $this->_aGrid = $aGrid;
     }
 
+    public function setIgnoreCacheInServiceCalls($b)
+    {
+        $this->_bIgnoreCacheInServiceCalls = $b;
+    }
+
     public function getName()
     {
         return $this->_sSystem;
@@ -296,7 +302,7 @@ class BxDolContentInfo extends BxDolFactory implements iBxDolFactoryObject
         if(!BxDolRequest::serviceExists($this->_sSystem, $sMethod))
             return false;
 
-        return BxDolService::call($this->_sSystem, $sMethod, array_slice(func_get_args(), 1));
+        return BxDolService::call($this->_sSystem, $sMethod, array_slice(func_get_args(), 1), 'Module', $this->_bIgnoreCacheInServiceCalls);
     }
 }
 

+ 2 - 1
modules/boonex/elasticsearch/classes/BxElsModule.php

@@ -457,9 +457,10 @@ class BxElsModule extends BxBaseModGeneralModule
             return false;
 
         foreach($aTypes as $sType) {
-            $oContentInfo = BxDolContentInfo::getObjectInstance($sType);
+            $oContentInfo = BxDolContentInfo::getObjectInstance($sType);        
             if(!$oContentInfo)
                 continue;
+            $oContentInfo->setIgnoreCacheInServiceCalls(true);
 
             $aIds = $oContentInfo->getAll(array('type' => 'all_ids'));
             if(empty($aIds) || !is_array($aIds))