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