Skip to content

Commit

Permalink
chore: defer closer when received
Browse files Browse the repository at this point in the history
  • Loading branch information
serenibyss committed Jun 8, 2021
1 parent 5bcc06c commit c85b950
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions cmd/influxd/inspect/tsm_verify.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,10 +70,10 @@ func (v *verifyUTF8) Run(cmd *cobra.Command, dataPath string, verbose bool) erro

for v.Next() {
reader, closer, err := v.TSMReader()
if closer != nil {
defer closer()
}
if err != nil {
if closer != nil {
go closer()
}
return err
}

Expand All @@ -93,7 +93,6 @@ func (v *verifyUTF8) Run(cmd *cobra.Command, dataPath string, verbose bool) erro
if fileErrors == 0 && verbose {
cmd.PrintErrf("%s: healthy\n", v.f)
}
go closer()
}

cmd.PrintErrf("Invalid Keys: %d / %d, in %vs\n", v.totalErrors, v.total, v.Elapsed().Seconds())
Expand All @@ -113,10 +112,10 @@ func (v *verifyChecksums) Run(cmd *cobra.Command, dataPath string, verbose bool)

for v.Next() {
reader, closer, err := v.TSMReader()
if closer != nil {
defer closer()
}
if err != nil {
if closer != nil {
go closer()
}
return err
}

Expand Down Expand Up @@ -144,7 +143,6 @@ func (v *verifyChecksums) Run(cmd *cobra.Command, dataPath string, verbose bool)
if fileErrors == 0 && verbose {
cmd.PrintErrf("%s: healthy\n", v.f)
}
go closer()
}

cmd.PrintErrf("Broken Blocks: %d / %d, in %vs\n", v.totalErrors, v.total, v.Elapsed().Seconds())
Expand Down

0 comments on commit c85b950

Please sign in to comment.