Skip to content

Commit da0a786

Browse files
committed
close underlying writer firstly during async writer closing
1 parent 1c9368b commit da0a786

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

async.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,13 +30,13 @@ type AsyncWriter struct {
3030

3131
// Close implements io.Closer, and closes the underlying Writer.
3232
func (w *AsyncWriter) Close() (err error) {
33-
w.ch <- nil
34-
err = <-w.chClose
3533
if closer, ok := w.Writer.(io.Closer); ok {
3634
if err1 := closer.Close(); err1 != nil {
3735
err = err1
3836
}
3937
}
38+
w.ch <- nil
39+
err = <-w.chClose
4040
return
4141
}
4242

0 commit comments

Comments
 (0)