Skip to content

Commit ee58bc7

Browse files
committed
kgo: avoid noise on consumer assignment
1 parent afa4e3b commit ee58bc7

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

Diff for: pkg/kgo/consumer_direct.go

+3-1
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,9 @@ func (cl *Client) AssignPartitions(opts ...DirectConsumeOpt) {
6565
c.mu.Lock()
6666
defer c.mu.Unlock()
6767

68-
c.unassignPrior()
68+
if c.typ != consumerTypeUnset {
69+
c.unassignPrior()
70+
}
6971

7072
d := &directConsumer{
7173
topics: make(map[string]Offset),

Diff for: pkg/kgo/consumer_group.go

+3-1
Original file line numberDiff line numberDiff line change
@@ -265,7 +265,9 @@ func (cl *Client) AssignGroup(group string, opts ...GroupOpt) {
265265
c.mu.Lock()
266266
defer c.mu.Unlock()
267267

268-
c.unassignPrior()
268+
if c.typ != consumerTypeUnset {
269+
c.unassignPrior()
270+
}
269271

270272
ctx, cancel := context.WithCancel(cl.ctx)
271273
g := &groupConsumer{

0 commit comments

Comments
 (0)