From 7a8b873d282ac42841096b2da7f8be616eaf3b1c Mon Sep 17 00:00:00 2001 From: sylwiaszunejko Date: Wed, 24 Jul 2024 15:38:49 +0200 Subject: [PATCH] Fix locking when retriving connection from controlConn --- session.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/session.go b/session.go index bbfc8d862..ea095622b 100644 --- a/session.go +++ b/session.go @@ -233,9 +233,10 @@ func (s *Session) init() error { if err := s.control.connect(hosts); err != nil { return err } - s.control.getConn().conn.mu.Lock() - s.tabletsRoutingV1 = s.control.getConn().conn.isTabletSupported() - s.control.getConn().conn.mu.Unlock() + conn := s.control.getConn().conn + conn.mu.Lock() + s.tabletsRoutingV1 = conn.isTabletSupported() + conn.mu.Unlock() if !s.cfg.DisableInitialHostLookup { var partitioner string