@algolia/ingestion 1.52.0 → 1.53.0

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.
@@ -33,7 +33,7 @@ var import_requester_node_http = require("@algolia/requester-node-http");
33
33
 
34
34
  // src/ingestionClient.ts
35
35
  var import_client_common = require("@algolia/client-common");
36
- var apiClientVersion = "1.52.0";
36
+ var apiClientVersion = "1.53.0";
37
37
  var REGIONS = ["eu", "us"];
38
38
  function getDefaultHosts(region) {
39
39
  const url = "data.{region}.algolia.com".replace("{region}", region);
@@ -130,6 +130,7 @@ function createIngestionClient({
130
130
  * @param chunkedPush.waitForTasks - Whether or not we should wait until every `batch` tasks has been processed, this operation may slow the total execution time of this method but is more reliable.
131
131
  * @param chunkedPush.batchSize - The size of the chunk of `objects`. The number of `batch` calls will be equal to `length(objects) / batchSize`. Defaults to 1000.
132
132
  * @param chunkedPush.referenceIndexName - This is required when targeting an index that does not have a push connector setup (e.g. a tmp index), but you wish to attach another index's transformation to it (e.g. the source index name).
133
+ * @param chunkedPush.maxRetries - The maximum number of retries when polling for task completion. 100 by default.
133
134
  * @param requestOptions - The requestOptions to send along with the query, they will be forwarded to the `getEvent` method and merged with the transporter requestOptions.
134
135
  */
135
136
  async chunkedPush({
@@ -138,7 +139,8 @@ function createIngestionClient({
138
139
  action = "addObject",
139
140
  waitForTasks,
140
141
  batchSize = 1e3,
141
- referenceIndexName
142
+ referenceIndexName,
143
+ maxRetries = 100
142
144
  }, requestOptions) {
143
145
  let records = [];
144
146
  let offset = 0;
@@ -174,8 +176,8 @@ function createIngestionClient({
174
176
  validate: (response) => response !== void 0,
175
177
  aggregator: () => retryCount += 1,
176
178
  error: {
177
- validate: () => retryCount >= 50,
178
- message: () => `The maximum number of retries exceeded. (${retryCount}/${50})`
179
+ validate: () => retryCount >= maxRetries,
180
+ message: () => `Stopped waiting for the task after ${maxRetries} retries. This does not mean the operation failed; it may still complete. If you need to keep polling, retry with a higher maxRetries.`
179
181
  },
180
182
  timeout: () => Math.min(retryCount * 1500, 5e3)
181
183
  });