diff --git a/src/jobs/AlgoliaBulkLoadTask.php b/src/jobs/AlgoliaBulkLoadTask.php index db21f5e..f752878 100644 --- a/src/jobs/AlgoliaBulkLoadTask.php +++ b/src/jobs/AlgoliaBulkLoadTask.php @@ -124,7 +124,7 @@ public function execute($queue) $queue->push(new AlgoliaChunkLoadTask([ 'description' => Craft::t('algolia-sync', 'Queueing a chunk of records to process start ('.$x.') limit ('.$this->standardLimit.')'), 'loadRecordType' => $this->loadRecordType, - 'limit' => 100, + 'limit' => $this->standardLimit, 'offset' => $x, 'elementType' => $elementType ])); @@ -141,20 +141,19 @@ public function execute($queue) if ($commercePlugin) { + // this is the total number of variants in the system $variantCount = \craft\commerce\elements\Variant::find()->typeId($sectionId)->count(); $queue = Craft::$app->getQueue(); for ($x=0; $x<$variantCount; $x=$x+$this->standardLimit) { - $queue->push(new AlgoliaChunkLoadTask([ - 'description' => Craft::t('algolia-sync', 'Queueing a chunk of records to process start ('.$x.') limit ('.$this->standardLimit.')'), + 'description' => Craft::t('algolia-sync', 'Queueing a chunk of '.$this->loadRecordType.' records to process start ('.$x.') limit ('.$this->standardLimit.')'), 'loadRecordType' => $this->loadRecordType, - 'limit' => 100, + 'limit' => $this->standardLimit, 'offset' => $x, 'elementType' => $elementType - ])); - + ])); } } break; @@ -185,8 +184,6 @@ public function execute($queue) $queue = Craft::$app->getQueue(); for ($x=0; $x<$userCount; $x=$x+$this->standardLimit) { - print_r('count: '.$x); - $progress = $x / $this->standardLimit; $this->setProgress($queue, $progress); diff --git a/src/jobs/AlgoliaChunkLoadTask.php b/src/jobs/AlgoliaChunkLoadTask.php index b33685f..9ef0a5b 100644 --- a/src/jobs/AlgoliaChunkLoadTask.php +++ b/src/jobs/AlgoliaChunkLoadTask.php @@ -96,7 +96,7 @@ public function execute($queue) CASE 'variant': - AlgoliaSync::$plugin->algoliaSyncService->logger("loading a chunk of product variants into the Algolia sync queue", basename(__FILE__) , __LINE__); + AlgoliaSync::$plugin->algoliaSyncService->logger("loading a chunk of product variants (with type ID = ".$sectionId.") into the Algolia sync queue. OffsetCount=".$offsetCount.", limitCount=".$limitCount, basename(__FILE__) , __LINE__); $commercePlugin = Craft::$app->plugins->getPlugin('commerce'); @@ -106,14 +106,14 @@ public function execute($queue) $variants = \craft\commerce\elements\Variant::find()->typeId($sectionId)->offset($offsetCount)->limit($limitCount)->status('enabled')->all(); if ($recordCount > 0) { - AlgoliaSync::$plugin->algoliaSyncService->logger("Now loading ".$recordCount." products to be synced", basename(__FILE__) , __LINE__); + AlgoliaSync::$plugin->algoliaSyncService->logger("We found ".$recordCount." products that need to be synced in this batch to be synced", basename(__FILE__) , __LINE__); $currentLoopCount = 0; foreach ($variants as $variant) { $progress = $currentLoopCount / $recordCount; $this->setProgress($queue, $progress); - AlgoliaSync::$plugin->algoliaSyncService->logger(print_r($variant, true), basename(__FILE__) , __LINE__); + // AlgoliaSync::$plugin->algoliaSyncService->logger(print_r($variant, true), basename(__FILE__) , __LINE__); AlgoliaSync::$plugin->algoliaSyncService->prepareAlgoliaSyncElement($variant); $currentLoopCount++;