File tree Expand file tree Collapse file tree 1 file changed +6
-1
lines changed Expand file tree Collapse file tree 1 file changed +6
-1
lines changed Original file line number Diff line number Diff line change @@ -59,7 +59,8 @@ type Broker struct {
59
59
kerberosAuthenticator GSSAPIKerberosAuth
60
60
clientSessionReauthenticationTimeMs int64
61
61
62
- throttleTimer * time.Timer
62
+ throttleTimer * time.Timer
63
+ throttleTimerLock sync.Mutex
63
64
}
64
65
65
66
// SASLMechanism specifies the SASL mechanism the client uses to authenticate with the broker
@@ -1697,6 +1698,8 @@ func (b *Broker) handleThrottledResponse(resp protocolBody) {
1697
1698
}
1698
1699
1699
1700
func (b * Broker ) setThrottle (throttleTime time.Duration ) {
1701
+ b .throttleTimerLock .Lock ()
1702
+ defer b .throttleTimerLock .Unlock ()
1700
1703
if b .throttleTimer != nil {
1701
1704
// if there is an existing timer stop/clear it
1702
1705
if ! b .throttleTimer .Stop () {
@@ -1707,6 +1710,8 @@ func (b *Broker) setThrottle(throttleTime time.Duration) {
1707
1710
}
1708
1711
1709
1712
func (b * Broker ) waitIfThrottled () {
1713
+ b .throttleTimerLock .Lock ()
1714
+ defer b .throttleTimerLock .Unlock ()
1710
1715
if b .throttleTimer != nil {
1711
1716
DebugLogger .Printf ("broker/%d waiting for throttle timer\n " , b .ID ())
1712
1717
<- b .throttleTimer .C
You can’t perform that action at this time.
0 commit comments