Skip to content

Commit

Permalink
Merge pull request #801 from Nosto/hotfix/6.1.6
Browse files Browse the repository at this point in the history
Fix iteration on API sync service
  • Loading branch information
dairbuirabass authored Oct 17, 2022
2 parents d496ed4 + 520c0f0 commit 1547058
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 3 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
All notable changes to this project will be documented in this file. This project adheres to Semantic Versioning.


### 6.1.6
* Fix iteration on API sync service

### 6.1.5
* Remove check for duplicate batch entries in the product update queue table

Expand Down
9 changes: 8 additions & 1 deletion Model/Service/Sync/Upsert/SyncService.php
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,7 @@ public function syncProducts(ProductCollection $collection, Store $store)
$account = $this->nostoHelperAccount->findAccount($store);
$this->startBenchmark(self::BENCHMARK_SYNC_NAME, self::BENCHMARK_SYNC_BREAKPOINT);

$index = 0;
$collection->setPageSize($this->apiBatchSize);
$iterator = new PagingIterator($collection);

Expand All @@ -146,7 +147,13 @@ public function syncProducts(ProductCollection $collection, Store $store)
$this->checkMemoryConsumption('product sync');
$op = new UpsertProduct($account, $this->nostoHelperUrl->getActiveDomain($store));
$op->setResponseTimeout($this->apiTimeout);
$products = $this->productRepository->getByIds($page->getAllIds());
$products = $this->productRepository->getByIds(
$page->getAllIds(
$this->apiBatchSize,
($iterator->getCurrentPageNumber() - 1) * $this->apiBatchSize
)
);
$index ++;
/** @var Product $product */
foreach ($products->getItems() as $product) {
$productIdsInBatch[] = $product->getId();
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "nosto/module-nostotagging",
"description": "Increase your conversion rate and average order value by delivering your customers personalized product recommendations throughout their shopping journey.",
"type": "magento2-module",
"version": "6.1.5",
"version": "6.1.6",
"require-dev": {
"phpmd/phpmd": "^2.5",
"sebastian/phpcpd": "*",
Expand Down
2 changes: 1 addition & 1 deletion etc/module.xml
Original file line number Diff line number Diff line change
Expand Up @@ -37,5 +37,5 @@
<!--suppress XmlUnboundNsPrefix -->
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
<module name="Nosto_Tagging" setup_version="6.1.5"/>
<module name="Nosto_Tagging" setup_version="6.1.6"/>
</config>

0 comments on commit 1547058

Please sign in to comment.