Skip to content

Commit 0c95330

Browse files
Merge pull request #1154 from ricado-group/1153-semaphore-disposed-exception
Fix for #1153 - Semaphore disposed before discarded tasks have finished
2 parents 9a1c4bd + beae1f9 commit 0c95330

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

projects/RabbitMQ.Client/client/impl/AsyncConsumerWorkService.cs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,14 @@ private static async Task HandleConcurrent(Work work, IModel model, SemaphoreSli
182182
finally
183183
{
184184
work.PostExecute();
185-
limiter.Release();
185+
186+
try
187+
{
188+
limiter.Release();
189+
}
190+
catch (ObjectDisposedException) // Prevents Exceptions in the Task's finalizer when the WorkPool is Stopped
191+
{
192+
}
186193
}
187194
}
188195

0 commit comments

Comments
 (0)