File tree Expand file tree Collapse file tree 1 file changed +14
-5
lines changed
pkg/file/redundancy/getter Expand file tree Collapse file tree 1 file changed +14
-5
lines changed Original file line number Diff line number Diff line change @@ -252,16 +252,25 @@ func (g *decoder) runStrategy(s Strategy) error {
252252 }(i )
253253 }
254254
255+ var result error
256+ readCount := 0
255257 for range c {
256- if g .fetchedCnt .Load () >= int32 (g .shardCnt ) {
257- return nil
258+ readCount ++
259+ // check for success
260+ if result == nil && g .fetchedCnt .Load () >= int32 (g .shardCnt ) {
261+ result = nil
262+ }
263+ // check for failure
264+ if result == nil && g .failedCnt .Load () > int32 (allowedErrs ) {
265+ result = errStrategyFailed
258266 }
259- if g .failedCnt .Load () > int32 (allowedErrs ) {
260- return errStrategyFailed
267+ // continue reading to ensure all goroutines complete
268+ if readCount >= len (m ) {
269+ break
261270 }
262271 }
263272
264- return nil
273+ return result
265274}
266275
267276// recover wraps the stages of data shard recovery:
You can’t perform that action at this time.
0 commit comments