Skip to content

Commit

Permalink
return writerError on writer.go:write function when w.dial() returns …
Browse files Browse the repository at this point in the history
…error to avoid locking on writer.go:WriteMessages method (because it expects always to have a res message) (segmentio#39)
  • Loading branch information
josledp authored and achille-roussel committed Dec 27, 2017
1 parent f88c22d commit e57b88a
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions writer.go
Original file line number Diff line number Diff line change
@@ -505,6 +505,9 @@ func (w *writer) dial() (conn *Conn, err error) {
func (w *writer) write(conn *Conn, batch []Message, resch [](chan<- error)) (ret *Conn, err error) {
if conn == nil {
if conn, err = w.dial(); err != nil {
for i, res := range resch {
res <- &writerError{msg: batch[i], err: err}
}
return
}
}

0 comments on commit e57b88a

Please sign in to comment.