Skip to content

Commit

Permalink
fix(dataflux): address deadlock when reading from ranges
Browse files Browse the repository at this point in the history
  • Loading branch information
jdnurme committed Dec 17, 2024
1 parent 2f99c97 commit 4bc85df
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions storage/dataflux/worksteal.go
Original file line number Diff line number Diff line change
Expand Up @@ -130,9 +130,13 @@ func (w *worker) doWorkstealListing(ctx context.Context) error {
time.Sleep(sleepDurationWhenIdle)
continue
} else {
newRange := <-w.lister.ranges
<-w.idleChannel
w.updateWorker(newRange.startRange, newRange.endRange, active)
select {
case newRange := <-w.lister.ranges:
<-w.idleChannel
w.updateWorker(newRange.startRange, newRange.endRange, active)
case <-time.After(sleepDurationWhenIdle):
continue
}
}
}
// Active worker to list next page of objects within the range
Expand Down Expand Up @@ -191,7 +195,6 @@ func (w *worker) shutDownSignal() bool {
w.result.mu.Unlock()

alreadyListedBatchSizeObjects := w.lister.batchSize > 0 && lenResult >= w.lister.batchSize

return noMoreObjects || alreadyListedBatchSizeObjects
}

Expand Down

0 comments on commit 4bc85df

Please sign in to comment.