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

Bugfix/issue 62 fix Close() on rows when a timeout during processing #64

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 20 additions & 5 deletions clickhouse_rows.go
Original file line number Diff line number Diff line change
Expand Up @@ -95,11 +95,26 @@ func (r *rows) Columns() []string {
}

func (r *rows) Close() error {
for range r.stream {
}
for err := range r.errors {
if err != nil {
r.err = err
active := 2
for {
select {
case _, ok := <-r.stream:
if !ok {
active--
if active == 0 {
return r.err
}
}
case err, ok := <-r.errors:
if err != nil {
r.err = err
}
if !ok {
active--
if active == 0 {
return r.err
}
}
}
}
return r.err
Expand Down
2 changes: 1 addition & 1 deletion conn_query.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,8 @@ func (c *connect) query(ctx context.Context, release func(*connect, error), quer
if err != nil {
errors <- err
}
close(errors)
close(stream)
close(errors)
release(c, err)
}()

Expand Down
Loading