Skip to content

Commit

Permalink
worker: goto loop if there are new slabs to upload
Browse files Browse the repository at this point in the history
  • Loading branch information
peterjan committed Oct 21, 2024
1 parent 5e29685 commit a79c257
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions worker/upload.go
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,7 @@ func (w *Worker) threadedUploadPackedSlabs(rs api.RedundancySettings, contractSe
interruptCtx, interruptCancel := context.WithCancel(w.shutdownCtx)
defer interruptCancel()

loop:
var wg sync.WaitGroup
for {
// block until we have memory
Expand Down Expand Up @@ -287,6 +288,14 @@ func (w *Worker) threadedUploadPackedSlabs(rs api.RedundancySettings, contractSe
// wait for all threads to finish
wg.Wait()

// no need to close out the thread if there's new packed slabs for upload
packedSlabs, err := w.bus.PackedSlabsForUpload(interruptCtx, defaultPackedSlabsLockDuration, uint8(rs.MinShards), uint8(rs.TotalShards), contractSet, 1)
if err != nil {
w.logger.Errorf("couldn't fetch packed slabs from bus: %v", err)
} else if len(packedSlabs) > 0 {
goto loop
}

fmt.Printf("DEBUG PJ: THREAD %v DONE\n", key)
}

Expand Down

0 comments on commit a79c257

Please sign in to comment.