Skip to content

Commit

Permalink
Fanout: Check individual errors (#272)
Browse files Browse the repository at this point in the history
  • Loading branch information
klauspost committed Jun 23, 2023
1 parent 802079f commit 560cb38
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions pkg/bench/fanout.go
Original file line number Diff line number Diff line change
Expand Up @@ -105,13 +105,28 @@ func (u *Fanout) Start(ctx context.Context, wait chan struct{}) (Operations, err
op.Err = err.Error()
}

var firstErr string
nErrs := 0
for _, r := range res {
if r.Error != "" {
if firstErr == "" {
firstErr = r.Error
}
nErrs++
}
}
if op.Err == "" && nErrs > 0 {
op.Err = fmt.Sprintf("%d copies failed. First error: %v", nErrs, firstErr)
}

if len(res) != u.Copies && op.Err == "" {
err := fmt.Sprint("short upload. want:", u.Copies, " copies, got:", len(res))
if op.Err == "" {
op.Err = err
}
u.Error(err)
}

cldone()
rcv <- op
}
Expand Down

0 comments on commit 560cb38

Please sign in to comment.