Browse Source

fix(#25310): revent hanging when acquiring closed channel after rabbitmq restart

pull/25311/head
Liu Ke 6 months ago
parent
commit
104b4d0a94
  1. 6
      framework/src/Volo.Abp.RabbitMQ/Volo/Abp/RabbitMQ/ChannelPool.cs

6
framework/src/Volo.Abp.RabbitMQ/Volo/Abp/RabbitMQ/ChannelPool.cs

@ -61,8 +61,6 @@ public class ChannelPool : IChannelPool, ISingletonDependency
} }
} }
poolItem.Acquire();
if (poolItem.Channel.IsClosed) if (poolItem.Channel.IsClosed)
{ {
await poolItem.DisposeAsync(); await poolItem.DisposeAsync();
@ -80,10 +78,10 @@ public class ChannelPool : IChannelPool, ISingletonDependency
Channels.TryAdd(channelName, poolItem); Channels.TryAdd(channelName, poolItem);
} }
} }
poolItem.Acquire();
} }
poolItem.Acquire();
return new ChannelAccessor( return new ChannelAccessor(
poolItem.Channel, poolItem.Channel,
channelName, channelName,

Loading…
Cancel
Save