Skip to content

Commit

Permalink
Drop lockedCandidatesForBatch and mark chunks as 'busy' when prepar…
Browse files Browse the repository at this point in the history
…ing (#3342)
  • Loading branch information
yaegor committed Dec 7, 2021
1 parent 10140cb commit a6270bf
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions packages/@uppy/aws-s3-multipart/src/MultipartUploader.js
Expand Up @@ -58,7 +58,6 @@ class MultipartUploader {
this.partsInProgress = 0
this.chunks = null
this.chunkState = null
this.lockedCandidatesForBatch = []

this.#initChunks()

Expand Down Expand Up @@ -181,8 +180,6 @@ class MultipartUploader {

const candidates = []
for (let i = 0; i < this.chunkState.length; i++) {
// eslint-disable-next-line no-continue
if (this.lockedCandidatesForBatch.includes(i)) continue
const state = this.chunkState[i]
// eslint-disable-next-line no-continue
if (state.done || state.busy) continue
Expand Down Expand Up @@ -242,7 +239,9 @@ class MultipartUploader {
}

async #prepareUploadParts (candidates) {
this.lockedCandidatesForBatch.push(...candidates)
candidates.forEach((i) => {
this.chunkState[i].busy = true
})

const result = await this.#retryable({
attempt: () => this.options.prepareUploadParts({
Expand Down

0 comments on commit a6270bf

Please sign in to comment.