@vegan-friendly/strapi-plugin-elasticsearch 0.3.2 → 0.3.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vegan-friendly/strapi-plugin-elasticsearch",
3
- "version": "0.3.2",
3
+ "version": "0.3.3",
4
4
  "description": "A Strapi plugin to enable using Elasticsearch with Strapi CMS.",
5
5
  "homepage": "https://github.com/vegan-friendly/strapi-plugin-elasticsearch",
6
6
  "strapi": {
@@ -78,15 +78,20 @@ exports.default = ({ strapi }) => {
78
78
  let prevPageData = [];
79
79
  let totalIndexed = 0;
80
80
  const pageLimit = 10000;
81
+ let pageErrorsInARow = 0;
81
82
  while (page <= pageLimit) {
82
83
  let pageData;
83
84
  try {
84
85
  pageData = await collection.extractData(page, pageSize);
86
+ pageErrorsInARow = 0;
85
87
  }
86
88
  catch (error) {
87
89
  strapi.log.error(`Error extracting data for page ${page} of ${collectionName}: ${error.message}`);
88
90
  errors += pageSize;
89
91
  page++;
92
+ if (pageErrorsInARow++ > 5) {
93
+ throw new Error(`Too many errors while extracting data for ${collectionName} at page ${page}. Stopping reindexing.`);
94
+ }
90
95
  continue;
91
96
  }
92
97
  strapi.log.debug(`Extracted ${pageData.length} items from ${collectionName} for page ${page}`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vegan-friendly/strapi-plugin-elasticsearch",
3
- "version": "0.3.2",
3
+ "version": "0.3.3",
4
4
  "description": "A Strapi plugin to enable using Elasticsearch with Strapi CMS.",
5
5
  "homepage": "https://github.com/vegan-friendly/strapi-plugin-elasticsearch",
6
6
  "strapi": {