From fdd1ae51ff06bae9d880845b9b3015d45a1e0544 Mon Sep 17 00:00:00 2001 From: Cliff Moon Date: Thu, 25 Apr 2024 12:36:18 -0700 Subject: [PATCH] fix a deadlock in the consumer mock --- mockautoconsumers.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/mockautoconsumers.go b/mockautoconsumers.go index 03f985bc..740df01b 100644 --- a/mockautoconsumers.go +++ b/mockautoconsumers.go @@ -249,7 +249,9 @@ func (pc *MockAutoPartitionConsumer) Close() error { pc.t.Errorf("Expected the messages channel for %s/%d to be drained on close, but found %d messages.", pc.topic, pc.partition, len(pc.messages)) } - pc.AsyncClose() + close(pc.messages) + close(pc.errors) + pc.consumed = false var ( closeErr error