public void AutoThrottleBatchSize(int amountOfItemsToIndex, long size, TimeSpan indexingDuration)
{
try
{
if (ReduceBatchSizeIfCloseToMemoryCeiling())
return;
if (ConsiderDecreasingBatchSize(amountOfItemsToIndex, indexingDuration))
return;
if (ConsiderIncreasingBatchSize(amountOfItemsToIndex, size, indexingDuration))
lastIncrease = SystemTime.UtcNow;
}
finally
{
RecordAmountOfItems(amountOfItemsToIndex);
}
}