From 291f220c33ab010713356fe4be4cbcfbc0bf5796 Mon Sep 17 00:00:00 2001 From: PJ Date: Fri, 8 Dec 2023 15:56:03 +0100 Subject: [PATCH] worker: update ongoing/interrupt --- worker/upload.go | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/worker/upload.go b/worker/upload.go index ceb7834a2..554c4105d 100644 --- a/worker/upload.go +++ b/worker/upload.go @@ -965,15 +965,6 @@ 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 { @@ -981,9 +972,13 @@ func (s *slabUpload) launch(req *sectorUploadReq) (interrupt bool, err error) { } // 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 @@ -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()