Skip to content

Commit

Permalink
worker: update ongoing/interrupt
Browse files Browse the repository at this point in the history
  • Loading branch information
peterjan committed Dec 8, 2023
1 parent bedd98b commit 291f220
Showing 1 changed file with 5 additions and 10 deletions.
15 changes: 5 additions & 10 deletions worker/upload.go
Original file line number Diff line number Diff line change
Expand Up @@ -965,25 +965,20 @@ func (s *slabUpload) finish() (sectors []object.Sector, _ error) {
return
}

func (s *slabUpload) ongoingOverdrive(sI int) bool {
for _, candidate := range s.candidates {
if candidate.req != nil && candidate.req.overdrive && candidate.req.sector.index == sI {
return true
}
}
return false
}

func (s *slabUpload) launch(req *sectorUploadReq) (interrupt bool, err error) {
// nothing to do
if req == nil {
return false, nil
}

// find candidate
var overdriving bool
var candidate *candidate
for _, c := range s.candidates {
if c.req != nil {
if c.req.sector.index == req.sector.index {
overdriving = true
}
continue
}
candidate = c
Expand All @@ -993,7 +988,7 @@ func (s *slabUpload) launch(req *sectorUploadReq) (interrupt bool, err error) {
// no candidate found
if candidate == nil {
err = errNoCandidateUploader
interrupt = !req.overdrive && !s.ongoingOverdrive(req.sector.index)
interrupt = !req.overdrive && !overdriving
span := trace.SpanFromContext(req.sector.ctx)
span.RecordError(err)
span.End()
Expand Down

0 comments on commit 291f220

Please sign in to comment.