[Backport 8.8] fix: keep track of indexSlice explicitly in bulk helper response handling loop (#1759) (#1903)
Co-authored-by: Karl Riis <karlriis97@gmail.com>
This commit is contained in:
@ -823,13 +823,13 @@ export default class Helpers {
|
|||||||
}
|
}
|
||||||
const retry = []
|
const retry = []
|
||||||
const { items } = result
|
const { items } = result
|
||||||
|
let indexSlice = 0
|
||||||
for (let i = 0, len = items.length; i < len; i++) {
|
for (let i = 0, len = items.length; i < len; i++) {
|
||||||
const action = items[i]
|
const action = items[i]
|
||||||
const operation = Object.keys(action)[0]
|
const operation = Object.keys(action)[0]
|
||||||
// @ts-expect-error
|
// @ts-expect-error
|
||||||
const responseItem = action[operation as keyof T.BulkResponseItemContainer]
|
const responseItem = action[operation as keyof T.BulkResponseItemContainer]
|
||||||
assert(responseItem !== undefined, 'The responseItem is undefined, please file a bug report')
|
assert(responseItem !== undefined, 'The responseItem is undefined, please file a bug report')
|
||||||
const indexSlice = operation !== 'delete' ? i * 2 : i
|
|
||||||
|
|
||||||
if (responseItem.status >= 400) {
|
if (responseItem.status >= 400) {
|
||||||
// 429 is the only staus code where we might want to retry
|
// 429 is the only staus code where we might want to retry
|
||||||
@ -857,6 +857,7 @@ export default class Helpers {
|
|||||||
} else {
|
} else {
|
||||||
stats.successful += 1
|
stats.successful += 1
|
||||||
}
|
}
|
||||||
|
operation === 'delete' ? indexSlice += 1 : indexSlice += 2
|
||||||
}
|
}
|
||||||
callback(null, retry)
|
callback(null, retry)
|
||||||
})
|
})
|
||||||
|
|||||||
Reference in New Issue
Block a user