Skip to content

Commit

Permalink
Fix error caused by incorrect select case statement
Browse files Browse the repository at this point in the history
Longhorn 8548

Signed-off-by: Derek Su <derek.su@suse.com>
  • Loading branch information
derekbit authored and innobead committed May 13, 2024
1 parent b5a2774 commit ed49dd3
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 15 deletions.
7 changes: 2 additions & 5 deletions sparse/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -195,11 +195,8 @@ func (client *syncClient) syncContent() error {
// the below select will exit once all error channels are closed, or a single
// channel has run into an error, which will lead to the ctx being cancelled
mergedErrc := mergeErrorChannels(ctx, errorChannels...)
select {
case err = <-mergedErrc:
break
default:
}
err = <-mergedErrc

return err
}

Expand Down
6 changes: 1 addition & 5 deletions sparse/sfold.go
Original file line number Diff line number Diff line change
Expand Up @@ -127,11 +127,7 @@ func coalesce(parentFileIo, childFileIo FileIoProcessor, fileSize int64, ops Fil
// the below select will exit once all error channels are closed, or a single
// channel has run into an error, which will lead to the ctx being cancelled
mergedErrc := mergeErrorChannels(ctx, errorChannels...)
select {
case err = <-mergedErrc:
break
default:
}
err = <-mergedErrc

log.Debugf("Finished fold for parent %v, child %v, size %v, elapsed %.2fs",
parentFileIo.Name(), childFileIo.Name(), fileSize,
Expand Down
6 changes: 1 addition & 5 deletions sparse/sprune.go
Original file line number Diff line number Diff line change
Expand Up @@ -101,11 +101,7 @@ func prune(parentFileIo, childFileIo FileIoProcessor, fileSize int64, ops FileHa
// the below select will exit once all error channels are closed, or a single
// channel has run into an error, which will lead to the ctx being cancelled
mergedErrc := mergeErrorChannels(ctx, errorChannels...)
select {
case err = <-mergedErrc:
break
default:
}
err = <-mergedErrc

log.Debugf("Finished pruning for parent %v, child %v, size %v, elapsed %.2fs",
parentFileIo.Name(), childFileIo.Name(), fileSize,
Expand Down

0 comments on commit ed49dd3

Please sign in to comment.