diff --git a/kernel/private/classes/ezpcontentpublishingqueueprocessor.php b/kernel/private/classes/ezpcontentpublishingqueueprocessor.php index 61a71a6c23c..ae016e0262f 100644 --- a/kernel/private/classes/ezpcontentpublishingqueueprocessor.php +++ b/kernel/private/classes/ezpcontentpublishingqueueprocessor.php @@ -33,6 +33,9 @@ public function __construct() $this->cleanupInterval = $this->contentINI->variable( 'PublishingSettings', 'AsynchronousCleanupInterval' ); $this->cleanupAgeLimit = $this->contentINI->variable( 'PublishingSettings', 'AsynchronousCleanupAgeLimit' ); + // initiate current time for cache refresh + $this->lastRefreshTimestamp = time(); + // Queue reader handler $this->queueReader = $this->contentINI->variable( 'PublishingSettings', 'AsynchronousPublishingQueueReader' ); $reflection = new ReflectionClass( $this->queueReader ); @@ -109,6 +112,8 @@ public function run() 'async.log' ); + $this->refreshCacheStateInfo(); + $pid = $publishingItem->publish(); pcntl_signal( SIGINT, $this->signalHandler ); $this->currentJobs[$pid] = $publishingItem; @@ -138,6 +143,22 @@ public function run() } } + /** + * Refreshes/reloads cache and other state information periodically. + */ + private function refreshCacheStateInfo() + { + if ( time() < ( $this->lastRefreshTimestamp + $this->sleepInterval ) ) + { + return; + } + + // Reload expiry timestamps + eZExpiryHandler::instance()->restore(); + + $this->lastRefreshTimestamp = time(); + } + /** * Checks WORKING processes, and removes from the queue those who are dead * @@ -353,6 +374,12 @@ private function getNextItem() */ private $cleanupLastTime; + /** + * Time counter for refresh of cache/state information + * @var int + */ + private $lastRefreshTimestamp; + /** * Interval for cleanup of finished processes. Default value is 12 hours in seconds * @var int