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
@@ -1694,6 +1695,8 @@ func (b *Broker) handleThrottledResponse(resp protocolBody) {
1694
1695
}
1695
1696
1696
1697
func (b * Broker ) setThrottle (throttleTime time.Duration ) {
1698
+ b .throttleTimerLock .Lock ()
1699
+ defer b .throttleTimerLock .Unlock ()
1697
1700
if b .throttleTimer != nil {
1698
1701
// if there is an existing timer stop/clear it
1699
1702
if ! b .throttleTimer .Stop () {
@@ -1704,6 +1707,8 @@ func (b *Broker) setThrottle(throttleTime time.Duration) {
1704
1707
}
1705
1708
1706
1709
func (b * Broker ) waitIfThrottled () {
1710
+ b .throttleTimerLock .Lock ()
1711
+ defer b .throttleTimerLock .Unlock ()
1707
1712
if b .throttleTimer != nil {
1708
1713
DebugLogger .Printf ("broker/%d waiting for throttle timer\n " , b .ID ())
1709
1714
<- b .throttleTimer .C
You can’t perform that action at this time.
0 commit comments