Skip to content

Commit

Permalink
Fix upload race condition with high disk concurrency (#198)
Browse files Browse the repository at this point in the history
  • Loading branch information
CyberDem0n authored and x4m committed Mar 5, 2019
1 parent 6505ab3 commit 159ee0a
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions bundle.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,15 +70,6 @@ func (bundle *Bundle) FinishQueue() error {
}
bundle.started = false

// At this point no new tarballs should be put into uploadQueue
for len(bundle.uploadQueue) > 0 {
select {
case otb := <-bundle.uploadQueue:
otb.AwaitUploads()
default:
}
}

// We have to deque exactly this count of workers
for i := 0; i < bundle.parallelTarballs; i++ {
tb := <-bundle.tarballQueue
Expand All @@ -92,6 +83,15 @@ func (bundle *Bundle) FinishQueue() error {
}
tb.AwaitUploads()
}

// At this point no new tarballs should be put into uploadQueue
for len(bundle.uploadQueue) > 0 {
select {
case otb := <-bundle.uploadQueue:
otb.AwaitUploads()
default:
}
}
return nil
}

Expand Down

0 comments on commit 159ee0a

Please sign in to comment.