We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 957f943 commit 8994085Copy full SHA for 8994085
pkg/kgo/broker.go
@@ -467,6 +467,18 @@ func (cxn *brokerCxn) init() error {
467
468
func (cxn *brokerCxn) requestAPIVersions() error {
469
maxVersion := int16(3)
470
+
471
+ // If the user configured a max versions, we check that the key exists
472
+ // before entering this function. Thus, we expect exists to be true,
473
+ // but we still doubly check it for sanity (as well as userMax, which
474
+ // can only be non-negative based off of LookupMaxKeyVersion's API).
475
+ if cxn.cl.cfg.maxVersions != nil {
476
+ userMax, exists := cxn.cl.cfg.maxVersions.LookupMaxKeyVersion(18) // 18 == api versions
477
+ if exists && userMax >= 0 {
478
+ maxVersion = userMax
479
+ }
480
481
482
start:
483
req := &kmsg.ApiVersionsRequest{
484
Version: maxVersion,
0 commit comments