Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: close query when finished moving #74

Merged
merged 1 commit into from
Apr 10, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 3 additions & 0 deletions convert.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,11 +76,13 @@ func Move(oldPath string, newPath string, out io.Writer) error {
break
}
if e.Error != nil {
res.Close()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could you defer a .Close() instead?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I want to close this before we finish the move, and I don't want to close it twice. I could have wrapped this in a function, but eh...

return e.Error
}

err := moveKey(oldDS, newDS, datastore.RawKey(e.Key))
if err != nil {
res.Close()
return err
}

Expand All @@ -89,6 +91,7 @@ func Move(oldPath string, newPath string, out io.Writer) error {
fmt.Fprintf(out, "\r%d keys so far", count)
}
}
res.Close()

if out != nil {
fmt.Fprintf(out, "\nCleaning Up...\n")
Expand Down