The problem is currently it runs pretty fine with limited number of reports (around 10 000), but on environments with much more reports it fails with Big amount of simultaneous requests for server causing heavy load on the server:
private void PerformSearch(SearchReportModel item)
{
var tasks = new List<Task>();
foreach (var term in item.SearchTerms)
{
var model = GetBaseQueryModel(item.Site);
tasks.Add(Task.Factory.StartNew(() => CheckSearchTerm(model, term, item.Site, item.Language)));
}
try
{
Task.WaitAll(tasks.ToArray());
}
catch (Exception ex)
{
Log4NetLogger.LogError(ex, ex.ToString());
throw;
}
}