chore: don't guard connection settings with the registry mutex (#32695)

This commit is contained in:
andig 2026-08-10 17:25:08 +02:00 • committed by GitHub
parent 136809f9b0
commit 232d367461
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -104,7 +104,7 @@ type meterConnection struct {
proto Protocol proto Protocol
refs int // count of references; first connection has ref count 0 refs int // count of references; first connection has ref count 0
// largest value requested by any of the sharing logical connections mu sync.Mutex
delay time.Duration delay time.Duration
connectDelay time.Duration connectDelay time.Duration
timeout time.Duration timeout time.Duration
@ -114,23 +114,23 @@ type meterConnection struct {
// setDelay applies the delay if larger than the current value // setDelay applies the delay if larger than the current value
func (c *meterConnection) setDelay(delay time.Duration) { func (c *meterConnection) setDelay(delay time.Duration) {
mu.Lock() c.mu.Lock()
defer mu.Unlock() defer c.mu.Unlock()
c.delay = max(c.delay, delay) c.delay = max(c.delay, delay)
} }
func (c *meterConnection) getDelay() time.Duration { func (c *meterConnection) getDelay() time.Duration {
mu.Lock() c.mu.Lock()
defer mu.Unlock() defer c.mu.Unlock()
return c.delay return c.delay
} }
// setConnectDelay applies the connect delay if larger than the current value // setConnectDelay applies the connect delay if larger than the current value
func (c *meterConnection) setConnectDelay(delay time.Duration) { func (c *meterConnection) setConnectDelay(delay time.Duration) {
mu.Lock() c.mu.Lock()
defer mu.Unlock() defer c.mu.Unlock()
if delay > c.connectDelay { if delay > c.connectDelay {
c.connectDelay = delay c.connectDelay = delay
@ -140,8 +140,8 @@ func (c *meterConnection) setConnectDelay(delay time.Duration) {
// setTimeout applies the timeout if larger than the current value // setTimeout applies the timeout if larger than the current value
func (c *meterConnection) setTimeout(timeout time.Duration) { func (c *meterConnection) setTimeout(timeout time.Duration) {
mu.Lock() c.mu.Lock()
defer mu.Unlock() defer c.mu.Unlock()
if timeout > c.timeout { if timeout > c.timeout {
c.timeout = timeout c.timeout = timeout