Wait clearing the close channel (#8250)

Close channel should not be nilled before goroutines have exited.

Fixes potential hang on closing.
This commit is contained in:
Klaus Post 2019-09-16 16:18:01 -07:00 committed by Harshavardhana
parent 14b137aa66
commit 017456df63

View File

@ -106,8 +106,8 @@ func (r *Reader) Read(dst sql.Record) (sql.Record, error) {
func (r *Reader) Close() error {
if r.close != nil {
close(r.close)
r.close = nil
r.readerWg.Wait()
r.close = nil
}
r.recordsRead = len(r.current)
if r.err == nil {