diff --git a/Mindscape.Raygun4Net.NetCore.Common/ThrottledBackgroundMessageProcessor.cs b/Mindscape.Raygun4Net.NetCore.Common/ThrottledBackgroundMessageProcessor.cs index 09fbccfe..e67a8757 100644 --- a/Mindscape.Raygun4Net.NetCore.Common/ThrottledBackgroundMessageProcessor.cs +++ b/Mindscape.Raygun4Net.NetCore.Common/ThrottledBackgroundMessageProcessor.cs @@ -163,7 +163,10 @@ private void CreateWorkerTask() /// private int CalculateDesiredWorkers(int queueSize) { - if (queueSize == 0) + // Should never have a _maxWorkerTasks of 0, but there's a couple of unit tests + // which use 0 to determine if messages are discarded when the queue is full + // so we need to allow for 0 workers to verify those tests. + if (queueSize == 0 || _maxWorkerTasks == 0) { return 0; } @@ -201,7 +204,9 @@ private static async Task RaygunMessageWorker(BlockingCollection