Skip to content

Commit

Permalink
fix: fix a deadlock issue when it occurs simultaneously: a goroutine …
Browse files Browse the repository at this point in the history
…is trying to lock, and another goroutine waits since full of channel buffers #440
  • Loading branch information
t2y committed Jul 19, 2023
1 parent 7778a1c commit 741471d
Show file tree
Hide file tree
Showing 4 changed files with 0 additions and 12 deletions.
2 changes: 0 additions & 2 deletions conn.go
Original file line number Diff line number Diff line change
Expand Up @@ -327,8 +327,6 @@ func (l *Conn) nextMessageID() int64 {
// GetLastError returns the last recorded error from goroutines like processMessages and reader.
// Only the last recorded error will be returned.
func (l *Conn) GetLastError() error {
l.messageMutex.Lock()
defer l.messageMutex.Unlock()
return l.err
}

Expand Down
4 changes: 0 additions & 4 deletions response.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,6 @@ func (r *searchResponse) Next() bool {
if r.err != nil {
return false
}
r.err = r.conn.GetLastError()
if r.err != nil {
return false
}
r.entry = res.Entry
r.referral = res.Referral
r.controls = res.Controls
Expand Down
2 changes: 0 additions & 2 deletions v3/conn.go
Original file line number Diff line number Diff line change
Expand Up @@ -327,8 +327,6 @@ func (l *Conn) nextMessageID() int64 {
// GetLastError returns the last recorded error from goroutines like processMessages and reader.
// // Only the last recorded error will be returned.
func (l *Conn) GetLastError() error {
l.messageMutex.Lock()
defer l.messageMutex.Unlock()
return l.err
}

Expand Down
4 changes: 0 additions & 4 deletions v3/response.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,6 @@ func (r *searchResponse) Next() bool {
if r.err != nil {
return false
}
r.err = r.conn.GetLastError()
if r.err != nil {
return false
}
r.entry = res.Entry
r.referral = res.Referral
r.controls = res.Controls
Expand Down

0 comments on commit 741471d

Please sign in to comment.