Skip to content

Commit

Permalink
hook: breaking API change: OnThrottle => OnBrokerThrottle
Browse files Browse the repository at this point in the history
This was meant to be a part of v0.8.0, I'm not sure how I missed it
considering I switched every other broker-specific hook to OnBroker.
  • Loading branch information
twmb committed Jun 13, 2021
1 parent b6ec050 commit 20e5912
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion pkg/kgo/broker.go
Original file line number Diff line number Diff line change
Expand Up @@ -1273,7 +1273,7 @@ func (cxn *brokerCxn) handleResps() {
}
cxn.cl.cfg.hooks.each(func(h Hook) {
if h, ok := h.(HookBrokerThrottle); ok {
h.OnThrottle(cxn.b.meta, time.Duration(millis)*time.Millisecond, throttlesAfterResp)
h.OnBrokerThrottle(cxn.b.meta, time.Duration(millis)*time.Millisecond, throttlesAfterResp)
}
})
}
Expand Down
8 changes: 4 additions & 4 deletions pkg/kgo/hooks.go
Original file line number Diff line number Diff line change
Expand Up @@ -146,17 +146,17 @@ type HookBrokerE2E interface {
// HookBrokerThrottle is called after a response to a request is read
// from a broker, and the response identifies throttling in effect.
type HookBrokerThrottle interface {
// OnThrottle is passed the broker metadata, the imposed throttling
// interval, and whether the throttle was applied before Kafka
// responded to them request or after.
// OnBrokerThrottle is passed the broker metadata, the imposed
// throttling interval, and whether the throttle was applied before
// Kafka responded to them request or after.
//
// For Kafka < 2.0.0, the throttle is applied before issuing a response.
// For Kafka >= 2.0.0, the throttle is applied after issuing a response.
//
// If throttledAfterResponse is false, then Kafka already applied the
// throttle. If it is true, the client internally will not send another
// request until the throttle deadline has passed.
OnThrottle(meta BrokerMetadata, throttleInterval time.Duration, throttledAfterResponse bool)
OnBrokerThrottle(meta BrokerMetadata, throttleInterval time.Duration, throttledAfterResponse bool)
}

// HookGroupManageError is called after every error that causes the client,
Expand Down

0 comments on commit 20e5912

Please sign in to comment.