From c87dc873320322950c26924aa234be17869855d5 Mon Sep 17 00:00:00 2001 From: Dmytro Kasianenko Date: Thu, 15 Aug 2024 12:43:41 +0200 Subject: [PATCH] fix(v2): fix IsReady lock If client is not ready, it will try to unlock unlocked lock, which panics with "Unlock of unlocked RWMutex". --- v2/client.go | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/v2/client.go b/v2/client.go index 7c38366..ca21f19 100644 --- a/v2/client.go +++ b/v2/client.go @@ -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) {