@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.
@@ -5,7 +5,7 @@ import { createHttpRequester } from "@algolia/requester-node-http";
5
5
 
6
6
  // src/ingestionClient.ts
7
7
  import { createAuth, createIterablePromise, createTransporter, getAlgoliaAgent } from "@algolia/client-common";
8
- var apiClientVersion = "1.52.0";
8
+ var apiClientVersion = "1.53.0";
9
9
  var REGIONS = ["eu", "us"];
10
10
  function getDefaultHosts(region) {
11
11
  const url = "data.{region}.algolia.com".replace("{region}", region);
@@ -102,6 +102,7 @@ function createIngestionClient({
102
102
  * @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.
103
103
  * @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.
104
104
  * @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).
105
+ * @param chunkedPush.maxRetries - The maximum number of retries when polling for task completion. 100 by default.
105
106
  * @param requestOptions - The requestOptions to send along with the query, they will be forwarded to the `getEvent` method and merged with the transporter requestOptions.
106
107
  */
107
108
  async chunkedPush({
@@ -110,7 +111,8 @@ function createIngestionClient({
110
111
  action = "addObject",
111
112
  waitForTasks,
112
113
  batchSize = 1e3,
113
- referenceIndexName
114
+ referenceIndexName,
115
+ maxRetries = 100
114
116
  }, requestOptions) {
115
117
  let records = [];
116
118
  let offset = 0;
@@ -146,8 +148,8 @@ function createIngestionClient({
146
148
  validate: (response) => response !== void 0,
147
149
  aggregator: () => retryCount += 1,
148
150
  error: {
149
- validate: () => retryCount >= 50,
150
- message: () => `The maximum number of retries exceeded. (${retryCount}/${50})`
151
+ validate: () => retryCount >= maxRetries,
152
+ 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.`
151
153
  },
152
154
  timeout: () => Math.min(retryCount * 1500, 5e3)
153
155
  });