From 815e16f5ff4bb031c23c0f5e2204c2fb5270c019 Mon Sep 17 00:00:00 2001 From: Savorboard Date: Wed, 8 Nov 2017 16:27:43 +0800 Subject: [PATCH] fix the producer connection returned --- src/DotNetCore.CAP.Kafka/PublishQueueExecutor.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/DotNetCore.CAP.Kafka/PublishQueueExecutor.cs b/src/DotNetCore.CAP.Kafka/PublishQueueExecutor.cs index 76129b5..6bbda6b 100644 --- a/src/DotNetCore.CAP.Kafka/PublishQueueExecutor.cs +++ b/src/DotNetCore.CAP.Kafka/PublishQueueExecutor.cs @@ -53,7 +53,9 @@ namespace DotNetCore.CAP.Kafka } finally { - _connectionPool.Return(producer); + var returned = _connectionPool.Return(producer); + if (!returned) + producer.Dispose(); } } }