Skip to content

Commit b06ecc0

Browse files
committed
ensure CloseAsync is called
1 parent 60d81ce commit b06ecc0

File tree

4 files changed

+36
-1
lines changed

4 files changed

+36
-1
lines changed

projects/Test/Integration/TestAsyncConsumer.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -485,6 +485,7 @@ await _channel.BasicConsumeAsync(queue: queueName, autoAck: false,
485485
await publishChannel.WaitForConfirmsOrDieAsync();
486486
}
487487

488+
await publishChannel.CloseAsync();
488489
return true;
489490
}
490491
});
@@ -610,6 +611,7 @@ public async Task TestDeclarationOfManyAutoDeleteQueuesWithTransientConsumer()
610611
var dummy = new AsyncEventingBasicConsumer(ch);
611612
ConsumerTag tag = await ch.BasicConsumeAsync(q, true, dummy);
612613
await ch.BasicCancelAsync(tag);
614+
await ch.CloseAsync();
613615
}
614616
}));
615617
}

projects/Test/Integration/TestExchangeDeclare.cs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,10 @@ await ch.ExchangeBindAsync(destination: ex_destination, source: exchangeName,
7676
{
7777
nse = e;
7878
}
79+
finally
80+
{
81+
await ch.CloseAsync();
82+
}
7983
}
8084
}
8185
var t = Task.Run(f);
@@ -103,6 +107,10 @@ await _channel.ExchangeUnbindAsync(destination: ex_destination, source: exchange
103107
{
104108
nse = e;
105109
}
110+
finally
111+
{
112+
await ch.CloseAsync();
113+
}
106114
}
107115
}
108116
var t = Task.Run(f);
@@ -139,6 +147,10 @@ public async Task TestConcurrentExchangeDeclareAndDelete()
139147
{
140148
nse = e;
141149
}
150+
finally
151+
{
152+
await ch.CloseAsync();
153+
}
142154
}
143155
});
144156
tasks.Add(t);
@@ -167,6 +179,10 @@ public async Task TestConcurrentExchangeDeclareAndDelete()
167179
{
168180
nse = e;
169181
}
182+
finally
183+
{
184+
await ch.CloseAsync();
185+
}
170186
}
171187
});
172188
tasks.Add(t);

projects/Test/Integration/TestQueueDeclare.cs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,10 @@ await ch.QueueBindAsync(queue: queueName,
118118
{
119119
nse = e;
120120
}
121+
finally
122+
{
123+
await ch.CloseAsync();
124+
}
121125
}
122126
}
123127
var t = Task.Run(f);
@@ -154,6 +158,10 @@ await ch.QueueUnbindAsync(queue: qname,
154158
{
155159
nse = e;
156160
}
161+
finally
162+
{
163+
await ch.CloseAsync();
164+
}
157165
}
158166
}
159167
var t = Task.Run(f);
@@ -190,6 +198,10 @@ public async Task TestConcurrentQueueDeclare()
190198
{
191199
nse = e;
192200
}
201+
finally
202+
{
203+
await ch.CloseAsync();
204+
}
193205
}
194206
});
195207
tasks.Add(t);
@@ -216,6 +228,10 @@ public async Task TestConcurrentQueueDeclare()
216228
{
217229
nse = e;
218230
}
231+
finally
232+
{
233+
await ch.CloseAsync();
234+
}
219235
}
220236
});
221237
tasks.Add(t);

projects/Test/Integration/TestToxiproxy.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -225,8 +225,9 @@ public async Task TestThatStoppedSocketResultsInHeartbeatTimeout()
225225
}
226226

227227
await ch.CloseAsync();
228-
await conn.CloseAsync();
229228
}
229+
230+
await conn.CloseAsync();
230231
}
231232
});
232233

0 commit comments

Comments
 (0)