From 58a0d8611a7b0a958dd819dd7b3d6f99efd177ed Mon Sep 17 00:00:00 2001 From: Valeriy Pikulskyy Date: Sat, 15 Jun 2024 21:00:22 +0400 Subject: [PATCH 1/4] [PEN-1694] Fix loading full reindex jobs from Algolia queue --- ...0-full-reindex-queue-jobs-processing.patch | 20 +++++++++++++++++++ README.md | 1 + patches.json | 4 ++++ 3 files changed, 25 insertions(+) create mode 100644 Patch-Algolia_AlgoliaSearch-3.11.0-full-reindex-queue-jobs-processing.patch diff --git a/Patch-Algolia_AlgoliaSearch-3.11.0-full-reindex-queue-jobs-processing.patch b/Patch-Algolia_AlgoliaSearch-3.11.0-full-reindex-queue-jobs-processing.patch new file mode 100644 index 0000000..beec45d --- /dev/null +++ b/Patch-Algolia_AlgoliaSearch-3.11.0-full-reindex-queue-jobs-processing.patch @@ -0,0 +1,20 @@ +--- Model/Queue.php ++++ Model/Queue.php +@@ -392,6 +392,9 @@ + $fullReindexJobs = $this->fetchJobs($fullReindexJobsLimit, true); + $fullReindexJobsCount = count($fullReindexJobs); + ++ // continue full reindex jobs without a break ++ $lastFullReindexJobId = max($this->getJobsIdsFromMergedJobs($fullReindexJobs)); ++ + $realtimeJobsLimit = (int) $maxJobs - $fullReindexJobsCount; + + $realtimeJobs = $this->fetchJobs($realtimeJobsLimit, false); +@@ -401,7 +404,6 @@ + + if ($jobsCount > 0 && $jobsCount < $maxJobs) { + $restLimit = $maxJobs - $jobsCount; +- $lastFullReindexJobId = max($this->getJobsIdsFromMergedJobs($jobs)); + + $restFullReindexJobs = $this->fetchJobs($restLimit, true, $lastFullReindexJobId); + diff --git a/README.md b/README.md index bc6f145..28c6bd8 100644 --- a/README.md +++ b/README.md @@ -193,6 +193,7 @@ algolia/algoliasearch-magento-2|Patch-Algolia_AlgoliaSearch-emulation-clean-scop algolia/algoliasearch-magento-2|Patch-Algolia_AlgoliaSearch-pages-trigger-index.patch| Page indexer listeners on mview | algolia/algoliasearch-magento-2|Patch-Algolia_AlgoliaSearch-remove-show-all-products.patch| Remove show all products | algolia/algoliasearch-magento-2|Patch-Algolia_AlgoliaSearch-check-request-path-to-empty.patch| [PR #1149](https://github.com/algolia/algoliasearch-magento-2/pull/1149) | +algolia/algoliasearch-magento-2|Patch-Algolia_AlgoliaSearch-3.11.0-full-reindex-queue-jobs-processing.patch| [PR #1539](https://github.com/algolia/algoliasearch-magento-2/pull/1539) |3.11.0 amasty/shopby|Patch-Amasty_Shopby-2.10.5-remove-price-indexer.patch| Remove auto price indexer for v2.10.5 |2.10.5 amasty/shopby|Patch-Amasty_Shopby-2.12.5-remove-price-indexer.patch| Remove auto price indexer for v2.12.5 |2.12.5 amasty/shopby|Patch-Amasty_Shopby-2.13.7-remove-price-indexer.patch| Remove auto price indexer for v2.13.7 |2.13.7 diff --git a/patches.json b/patches.json index ef681cb..6f3888e 100644 --- a/patches.json +++ b/patches.json @@ -669,6 +669,10 @@ "Remove auto price indexer for v2.12.5": { "file": "Patch-Amasty_Shopby-2.12.5-remove-price-indexer.patch", "version": "*" + }, + "Processing full reindex queue jobs for v3.11.0": { + "file": "Patch-Algolia_AlgoliaSearch-3.11.0-full-reindex-queue-jobs-processing.patch", + "version": "*" } }, "magento/module-config": { From af9e3632443ef9f518956d382909f8a998c29297 Mon Sep 17 00:00:00 2001 From: Valeriy Pikulskyy Date: Sun, 16 Jun 2024 11:11:17 +0400 Subject: [PATCH 2/4] [PEN-1694] Fix loading full reindex jobs from Algolia queue - calculate last job id when required --- ....11.0-full-reindex-queue-jobs-processing.patch | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/Patch-Algolia_AlgoliaSearch-3.11.0-full-reindex-queue-jobs-processing.patch b/Patch-Algolia_AlgoliaSearch-3.11.0-full-reindex-queue-jobs-processing.patch index beec45d..74bcf6e 100644 --- a/Patch-Algolia_AlgoliaSearch-3.11.0-full-reindex-queue-jobs-processing.patch +++ b/Patch-Algolia_AlgoliaSearch-3.11.0-full-reindex-queue-jobs-processing.patch @@ -1,20 +1,11 @@ --- Model/Queue.php -+++ Model/Queue.php -@@ -392,6 +392,9 @@ - $fullReindexJobs = $this->fetchJobs($fullReindexJobsLimit, true); - $fullReindexJobsCount = count($fullReindexJobs); - -+ // continue full reindex jobs without a break -+ $lastFullReindexJobId = max($this->getJobsIdsFromMergedJobs($fullReindexJobs)); -+ - $realtimeJobsLimit = (int) $maxJobs - $fullReindexJobsCount; - - $realtimeJobs = $this->fetchJobs($realtimeJobsLimit, false); -@@ -401,7 +404,6 @@ ++++ Model/Queue.php (date 1718521678000) +@@ -401,7 +401,7 @@ if ($jobsCount > 0 && $jobsCount < $maxJobs) { $restLimit = $maxJobs - $jobsCount; - $lastFullReindexJobId = max($this->getJobsIdsFromMergedJobs($jobs)); ++ $lastFullReindexJobId = max($this->getJobsIdsFromMergedJobs($fullReindexJobs)); $restFullReindexJobs = $this->fetchJobs($restLimit, true, $lastFullReindexJobId); From a09bf3b0142afe19ba8638d1ae674aa3ad9e5550 Mon Sep 17 00:00:00 2001 From: Valeriy Pikulskyy Date: Wed, 19 Jun 2024 07:33:10 +0400 Subject: [PATCH 3/4] [PEN-1694] Fix for case no full reindex jobs --- ...ch-3.11.0-full-reindex-queue-jobs-processing.patch | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/Patch-Algolia_AlgoliaSearch-3.11.0-full-reindex-queue-jobs-processing.patch b/Patch-Algolia_AlgoliaSearch-3.11.0-full-reindex-queue-jobs-processing.patch index 74bcf6e..9eeda4f 100644 --- a/Patch-Algolia_AlgoliaSearch-3.11.0-full-reindex-queue-jobs-processing.patch +++ b/Patch-Algolia_AlgoliaSearch-3.11.0-full-reindex-queue-jobs-processing.patch @@ -1,11 +1,16 @@ --- Model/Queue.php -+++ Model/Queue.php (date 1718521678000) -@@ -401,7 +401,7 @@ ++++ Model/Queue.php +@@ -401,7 +401,12 @@ if ($jobsCount > 0 && $jobsCount < $maxJobs) { $restLimit = $maxJobs - $jobsCount; - $lastFullReindexJobId = max($this->getJobsIdsFromMergedJobs($jobs)); -+ $lastFullReindexJobId = max($this->getJobsIdsFromMergedJobs($fullReindexJobs)); ++ ++ if (count($fullReindexJobs) > 0) { ++ $lastFullReindexJobId = max($this->getJobsIdsFromMergedJobs($fullReindexJobs)); ++ } else { ++ $lastFullReindexJobId = max($this->getJobsIdsFromMergedJobs($jobs)); ++ } $restFullReindexJobs = $this->fetchJobs($restLimit, true, $lastFullReindexJobId); From ef7153bb1d18ee06d774904610ccadccc8e4132d Mon Sep 17 00:00:00 2001 From: Valeriy Pikulskyy Date: Wed, 19 Jun 2024 07:40:32 +0400 Subject: [PATCH 4/4] [PEN-1694] Reuse jobs count variable --- ...lgoliaSearch-3.11.0-full-reindex-queue-jobs-processing.patch | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Patch-Algolia_AlgoliaSearch-3.11.0-full-reindex-queue-jobs-processing.patch b/Patch-Algolia_AlgoliaSearch-3.11.0-full-reindex-queue-jobs-processing.patch index 9eeda4f..ed7dc56 100644 --- a/Patch-Algolia_AlgoliaSearch-3.11.0-full-reindex-queue-jobs-processing.patch +++ b/Patch-Algolia_AlgoliaSearch-3.11.0-full-reindex-queue-jobs-processing.patch @@ -6,7 +6,7 @@ $restLimit = $maxJobs - $jobsCount; - $lastFullReindexJobId = max($this->getJobsIdsFromMergedJobs($jobs)); + -+ if (count($fullReindexJobs) > 0) { ++ if ($fullReindexJobsCount > 0) { + $lastFullReindexJobId = max($this->getJobsIdsFromMergedJobs($fullReindexJobs)); + } else { + $lastFullReindexJobId = max($this->getJobsIdsFromMergedJobs($jobs));