Skip to content

Commit

Permalink
fix dup upload consensus (#1195)
Browse files Browse the repository at this point in the history
  • Loading branch information
Hitenjain14 authored and YarikRevich committed Aug 30, 2023
1 parent 47cfad4 commit 0e1c494
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions zboxcore/sdk/chunked_upload.go
Expand Up @@ -671,8 +671,12 @@ func (su *ChunkedUpload) processUpload(chunkStartIndex, chunkEndIndex int,
err = b.sendUploadRequest(ctx, su, chunkEndIndex, isFinal, su.encryptedKey, body, formData, pos)
if err != nil {
if strings.Contains(err.Error(), "duplicate") {
atomic.AddInt32(&su.addConsensus, 1)
su.consensus.Done()
errC := atomic.AddInt32(&su.addConsensus, 1)
if errC >= int32(su.consensus.consensusThresh) {
wgErrors <- err
} else {
su.consensus.Done()
}
return
}
logger.Logger.Error("error during sendUploadRequest", err)
Expand Down

0 comments on commit 0e1c494

Please sign in to comment.