Skip to content

Commit

Permalink
fix(v2): fix IsReady lock
Browse files Browse the repository at this point in the history
If client is not ready, it will try to unlock unlocked lock,
which panics with "Unlock of unlocked RWMutex".
  • Loading branch information
dmksnnk committed Aug 15, 2024
1 parent 95b11b6 commit ca9e9fb
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions v2/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -155,10 +155,12 @@ func (c *Client) IsReady() bool {
default:
}

ready := c.mux.TryLock()
defer c.mux.Unlock()
if c.mux.TryLock() {
c.mux.Unlock()
return true
}

return ready
return false
}

func (c *Client) fatal(err error) {
Expand Down

0 comments on commit ca9e9fb

Please sign in to comment.