From 8f1e7323f4e72149af58b0fd0868362642c7853c Mon Sep 17 00:00:00 2001 From: Travis Bischel Date: Wed, 7 Jul 2021 21:13:52 -0600 Subject: [PATCH] producer: use ErrClientClosed properly if waiting to produce Previously we would just return the client context, but we may as well properly promise ErrClientClosed. --- pkg/kgo/producer.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/kgo/producer.go b/pkg/kgo/producer.go index a3dd05ff..2368db73 100644 --- a/pkg/kgo/producer.go +++ b/pkg/kgo/producer.go @@ -291,7 +291,7 @@ func (cl *Client) Produce( select { case <-p.waitBuffer: case <-cl.ctx.Done(): - drainBuffered(cl.ctx.Err()) + drainBuffered(ErrClientClosed) return case <-ctx.Done(): drainBuffered(ctx.Err())