public void BatchProcessingComplete()
{
int indexingAge = Interlocked.Increment(ref currentIndexingAge);
// make sure that we don't have too much "future cache" items
const int numberOfIndexingGenerationsAllowed = 64;
foreach (FutureIndexBatch source in futureIndexBatches.Values.Where(x => (indexingAge - x.Age) > numberOfIndexingGenerationsAllowed).ToList())
{
ObserveDiscardedTask(source);
FutureIndexBatch _;
futureIndexBatches.TryRemove(source.StartingEtag, out _);
}
}