diff --git a/src/Queue/MessageHandler/ProcessResourceHandler.php b/src/Queue/MessageHandler/ProcessResourceHandler.php index 6572dff..af697e1 100644 --- a/src/Queue/MessageHandler/ProcessResourceHandler.php +++ b/src/Queue/MessageHandler/ProcessResourceHandler.php @@ -6,7 +6,6 @@ use DynamicSearchBundle\Logger\LoggerInterface; use DynamicSearchBundle\Queue\Message\ProcessResourceMessage; use DynamicSearchBundle\Runner\ResourceRunnerInterface; -use Pimcore\Model\Tool\TmpStore; use Symfony\Component\Messenger\Handler\Acknowledger; use Symfony\Component\Messenger\Handler\BatchHandlerInterface; use Symfony\Component\Messenger\Handler\BatchHandlerTrait; @@ -29,9 +28,6 @@ public function __invoke(ProcessResourceMessage $message, ?Acknowledger $ack) private function process(array $jobs): void { - - TmpStore::set('dynamic_search_processor__last_batch', time()); - $groupedResourceMetas = []; /** @@ -75,27 +71,6 @@ private function process(array $jobs): void } } - private function shouldFlush(): bool - { - if ($this->getBatchSize() <= count($this->jobs)) { - return true; - } - $lastRunEntry = TmpStore::get('dynamic_search_processor__last_batch'); - if (!$lastRunEntry instanceof TmpStore) { - TmpStore::set('dynamic_search_processor__last_batch', time()); - return false; - } - $lastRun = (int)$lastRunEntry->getData(); - $now = time(); - $shouldFlush = $lastRun + $this->getBatchMaxAge() <= $now; - return $shouldFlush; - } - - private function getBatchMaxAge(): int - { - return 60; - } - private function getBatchSize(): int { return 50; diff --git a/src/Queue/MessageHandler/QueuedResourcesHandler.php b/src/Queue/MessageHandler/QueuedResourcesHandler.php index 611383a..01b280e 100644 --- a/src/Queue/MessageHandler/QueuedResourcesHandler.php +++ b/src/Queue/MessageHandler/QueuedResourcesHandler.php @@ -9,7 +9,6 @@ use DynamicSearchBundle\Queue\Message\ProcessResourceMessage; use DynamicSearchBundle\Queue\Message\QueueResourceMessage; use Pimcore\Model\Element; -use Pimcore\Model\Tool\TmpStore; use Symfony\Component\Messenger\Handler\Acknowledger; use Symfony\Component\Messenger\Handler\BatchHandlerInterface; use Symfony\Component\Messenger\Handler\BatchHandlerTrait; @@ -35,8 +34,6 @@ public function __invoke(QueueResourceMessage $message, ?Acknowledger $ack = nul private function process(array $jobs): void { - TmpStore::set('dynamic_search_queue__last_batch', time()); - /** * @var QueueResourceMessage $message * @var Acknowledger $ack @@ -107,27 +104,6 @@ protected function generateResourceMeta(string $contextName, string $dispatchTyp return $normalizedResourceStack; } - private function shouldFlush(): bool - { - if ($this->getBatchSize() <= count($this->jobs)) { - return true; - } - $lastRunEntry = TmpStore::get('dynamic_search_queue__last_batch'); - if (!$lastRunEntry instanceof TmpStore) { - TmpStore::set('dynamic_search_queue__last_batch', time()); - return false; - } - $lastRun = (int)$lastRunEntry->getData(); - $now = time(); - $shouldFlush = $lastRun + $this->getBatchMaxAge() <= $now; - return $shouldFlush; - } - - private function getBatchMaxAge(): int - { - return 30; - } - private function getBatchSize(): int { return 50;