Skip to content

Commit c6d4a7e

Browse files
committed
chore: determine wait batch size on batch size
1 parent e43bca2 commit c6d4a7e

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

templates/javascript/clients/client/api/ingestionHelpers.mustache

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ async chunkedPush(
2424
): Promise<Array<WatchResponse>> {
2525
let records: Array<PushTaskRecords> = [];
2626
const responses: Array<WatchResponse> = [];
27+
const waitBatchSize = Math.floor(batchSize / 10);
2728
2829
const objectEntries = objects.entries();
2930
for (const [i, obj] of objectEntries) {
@@ -35,8 +36,8 @@ async chunkedPush(
3536
records = [];
3637
}
3738

38-
if (waitForTasks && (responses.length % 50 === 0 || i === objects.length - 1)) {
39-
for (const resp of responses.slice(-50)) {
39+
if (waitForTasks && (responses.length % waitBatchSize === 0 || i === objects.length - 1)) {
40+
for (const resp of responses.slice(-waitBatchSize)) {
4041
if (!resp.eventID) {
4142
throw new Error('received unexpected response from the push endpoint, eventID must not be undefined');
4243
}

0 commit comments

Comments
 (0)