Skip to content

Commit c5e3924

Browse files
author
John Simons
committed
Added timeout to ensure we do not block forever
1 parent 38a43b8 commit c5e3924

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/NServiceBus.RabbitMQ/RabbitMqDequeueStrategy.cs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -146,10 +146,13 @@ void StartConsumer(string queue)
146146

147147
void ConsumeMessages(object state)
148148
{
149-
try
149+
if (!tracksRunningThreads.Wait(TimeSpan.FromSeconds(1)))
150150
{
151-
tracksRunningThreads.Wait();
151+
return;
152+
}
152153

154+
try
155+
{
153156
var parameters = (ConsumeParams)state;
154157
var connection = connectionManager.GetConsumeConnection();
155158

0 commit comments

Comments
 (0)