MCPcopy
hub / github.com/IBM/sarama / setThrottle

Method setThrottle

broker.go:1937–1947  ·  view source on GitHub ↗
(throttleTime time.Duration)

Source from the content-addressed store, hash-verified

1935}
1936
1937func (b *Broker) setThrottle(throttleTime time.Duration) {
1938 b.throttleTimerLock.Lock()
1939 defer b.throttleTimerLock.Unlock()
1940 if b.throttleTimer != nil {
1941 // if there is an existing timer stop/clear it
1942 if !b.throttleTimer.Stop() {
1943 <-b.throttleTimer.C
1944 }
1945 }
1946 b.throttleTimer = time.NewTimer(throttleTime)
1947}
1948
1949func (b *Broker) waitIfThrottled() {
1950 b.throttleTimerLock.Lock()

Callers 1

Calls 1

StopMethod · 0.80

Tested by

no test coverage detected