You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit d1f8a51
Browse filesBrowse the repository at this point in the historyBrowse files
throw new Error('`transformationOptions` must be set in the client config before calling this method. It defaults to the Ingestion API defaults. See https://www.algolia.com/doc/libraries/sdk/methods/ingestion/');
throw new Error('`transformationOptions` must be set in the client config before calling this method. It defaults to the Ingestion API defaults. See https://www.algolia.com/doc/libraries/sdk/methods/ingestion/');
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.`,
64
+
},
65
+
timeout: (): number => Math.min(retryCount * 1500, 5000),
66
+
});
67
+
}
68
+
};
69
+
32
70
const objectEntries = objects.entries();
33
71
for (const [i, obj] of objectEntries) {
34
72
records.push(obj as PushTaskRecords);
@@ -39,40 +77,18 @@ async chunkedPush(
39
77
records = [];
40
78
}
41
79
42
-
if (waitForTasks && responses.length > 0 && (responses.length % waitBatchSize === 0 || i === objects.length - 1)) {
43
-
for (const resp of responses.slice(offset, offset+waitBatchSize)) {
44
-
if (!resp.eventID) {
45
-
throw new Error('received unexpected response from the push endpoint, eventID must not be undefined');
46
-
}
47
-
48
-
let retryCount = 0;
49
-
50
-
await createIterablePromise({
51
-
func: async () => {
52
-
if (resp.eventID === undefined ||!resp.eventID) {
53
-
throw new Error('received unexpected response from the push endpoint, eventID must not be undefined');
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.`,
69
-
},
70
-
timeout: (): number => Math.min(retryCount * 1500, 5000),
71
-
});
72
-
}
80
+
// Only wait once at least `waitBatchSize` un-polled responses have accumulated, and advance the
81
+
// cursor by exactly that many, so every pushed task is polled once and only once.
82
+
if (waitForTasks && responses.length - offset >= waitBatchSize) {
0 commit comments