From e224e902f1cff624b29906e83df576ba64ffae25 Mon Sep 17 00:00:00 2001 From: Travis Bischel Date: Fri, 7 Jul 2023 18:17:48 -0600 Subject: [PATCH] kgo: allow HookBrokerRead and HookBrokerE2E to both be called --- pkg/kgo/broker.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pkg/kgo/broker.go b/pkg/kgo/broker.go index 3602aac4..5383e7b4 100644 --- a/pkg/kgo/broker.go +++ b/pkg/kgo/broker.go @@ -1217,10 +1217,10 @@ func (cxn *brokerCxn) readResponse( bytesRead, buf, readWait, timeToRead, readErr := cxn.readConn(ctx, timeout, readEnqueue) cxn.cl.cfg.hooks.each(func(h Hook) { - switch h := h.(type) { - case HookBrokerRead: + if h, ok := h.(HookBrokerRead); ok { h.OnBrokerRead(cxn.b.meta, key, bytesRead, readWait, timeToRead, readErr) - case HookBrokerE2E: + } + if h, ok := h.(HookBrokerE2E); ok { h.OnBrokerE2E(cxn.b.meta, key, BrokerE2E{ BytesWritten: bytesWritten, BytesRead: bytesRead,