Skip to content

Commit

Permalink
(#50) Check if channel is in use before close
Browse files Browse the repository at this point in the history
There is no beautiful way to do this.
  • Loading branch information
par.dahlman committed Feb 14, 2016
1 parent f0d5128 commit 04ae0ad
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/RawRabbit/Operations/Requester.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ public class Requester<TMessageContext> : OperatorBase, IRequester where TMessag
private readonly ConcurrentDictionary<string, Timer> _requestTimerDictionary;
private Timer _disposeConsumerTimer;
private readonly ILogger _logger = LogManager.GetLogger<Requester<TMessageContext>>();
private bool _channelActive;

public Requester(
IChannelFactory channelFactory,
Expand Down Expand Up @@ -91,10 +92,16 @@ private void CreateOrUpdateDisposeTimer()
{
if (_disposeConsumerTimer != null)
{
_channelActive = true;
return;
}
_disposeConsumerTimer = new Timer(state =>
{
if (_channelActive)
{
_channelActive = false;
return;
}
if (!_responseTcsDictionary.IsEmpty)
{
return;
Expand Down

0 comments on commit 04ae0ad

Please sign in to comment.