From 25ff7a688ee3b7cdb73257732f8f53a9713de371 Mon Sep 17 00:00:00 2001 From: Savorboard Date: Wed, 8 Nov 2017 16:28:26 +0800 Subject: [PATCH] dispose resource when connection pool is full --- src/DotNetCore.CAP.RabbitMQ/PublishQueueExecutor.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/DotNetCore.CAP.RabbitMQ/PublishQueueExecutor.cs b/src/DotNetCore.CAP.RabbitMQ/PublishQueueExecutor.cs index c7e828f..3f0045e 100644 --- a/src/DotNetCore.CAP.RabbitMQ/PublishQueueExecutor.cs +++ b/src/DotNetCore.CAP.RabbitMQ/PublishQueueExecutor.cs @@ -53,7 +53,9 @@ namespace DotNetCore.CAP.RabbitMQ } finally { - _connectionChannelPool.Return(channel); + var returned = _connectionChannelPool.Return(channel); + if (!returned) + channel.Dispose(); } } }