Skip to content

Commit 78d6053

Browse files
michaelklishinlukebakken
authored andcommitted
Merge pull request #1154 from ricado-group/1153-semaphore-disposed-exception
Fix for #1153 - Semaphore disposed before discarded tasks have finished (cherry picked from commit 0c95330)
1 parent 3365ff6 commit 78d6053

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
@@ -178,7 +178,14 @@ private static async Task HandleConcurrent(Work work, IModel model, SemaphoreSli
178178
finally
179179
{
180180
work.PostExecute();
181-
limiter.Release();
181+
182+
try
183+
{
184+
limiter.Release();
185+
}
186+
catch (ObjectDisposedException) // Prevents Exceptions in the Task's finalizer when the WorkPool is Stopped
187+
{
188+
}
182189
}
183190
}
184191

0 commit comments

Comments
 (0)