public int GetScalingAmount(QueueInfo queueInfo, int consumersRunningCount) { var consumersByRatio = queueInfo.MessageCount / _messagesPerConsumerWorkerRatio; int idealConsumerCount; if (consumersByRatio < _minConcurrentConsumers) { idealConsumerCount = Convert.ToInt32(_minConcurrentConsumers); } else if (consumersByRatio > _maxConcurrentConsumers) { idealConsumerCount = Convert.ToInt32(_maxConcurrentConsumers); } else { idealConsumerCount = Convert.ToInt32(consumersByRatio); } var scalingAmount = idealConsumerCount - consumersRunningCount; return(scalingAmount); }
public int GetScalingAmount(QueueInfo queueInfo, int consumersRunningCount) { var consumersByRatio = queueInfo.MessageCount / _messagesPerConsumerWorkerRatio; int idealConsumerCount; if (consumersByRatio < _minConcurrentConsumers) { idealConsumerCount = Convert.ToInt32(_minConcurrentConsumers); } else if (consumersByRatio > _maxConcurrentConsumers) { idealConsumerCount = Convert.ToInt32(_maxConcurrentConsumers); } else { idealConsumerCount = Convert.ToInt32(consumersByRatio); } var scalingAmount = idealConsumerCount - consumersRunningCount; return scalingAmount; }