| 1920 | } |
| 1921 | |
| 1922 | func (b *Broker) handleThrottledResponse(resp protocolBody) { |
| 1923 | throttledResponse, ok := resp.(throttleSupport) |
| 1924 | if !ok { |
| 1925 | return |
| 1926 | } |
| 1927 | throttleTime := throttledResponse.throttleTime() |
| 1928 | if throttleTime == time.Duration(0) { |
| 1929 | return |
| 1930 | } |
| 1931 | DebugLogger.Printf( |
| 1932 | "broker/%d %T throttled %v\n", b.ID(), resp, throttleTime) |
| 1933 | b.setThrottle(throttleTime) |
| 1934 | b.updateThrottleMetric(throttleTime) |
| 1935 | } |
| 1936 | |
| 1937 | func (b *Broker) setThrottle(throttleTime time.Duration) { |
| 1938 | b.throttleTimerLock.Lock() |