Update TaxonomyService.cs

This commit is contained in:
mvarblow
2015-09-18 10:45:16 -04:00
parent 5a6ba5ddd6
commit d080037af9

View File

@@ -30,6 +30,7 @@ namespace Orchard.Taxonomies.Services {
private readonly ShellSettings _shellSettings;
private readonly IShellDescriptorManager _shellDescriptorManager;
private readonly HashSet<int> _processedTermParts = new HashSet<int>();
public TaxonomyService(
IRepository<TermContentItem> termContentItemRepository,
@@ -266,8 +267,13 @@ namespace Orchard.Taxonomies.Services {
}
var termPartRecordIds = termList.Select(t => t.Term.TermRecord.Id).ToArray();
if (termPartRecordIds.Length > 0) {
_processingEngine.AddTask(_shellSettings, _shellDescriptorManager.GetShellDescriptor(), "ITermCountProcessor.Process", new Dictionary<string, object> { { "termPartRecordIds", termPartRecordIds } });
if (termPartRecordIds.Any()) {
if (!_processedTermParts.Any()) {
_processingEngine.AddTask(_shellSettings, _shellDescriptorManager.GetShellDescriptor(), "ITermCountProcessor.Process", new Dictionary<string, object> { { "termPartRecordIds", _processedTermParts } });
}
foreach (var termPartRecordId in termPartRecordIds) {
_processedTermParts.Add(termPartRecordId);
}
}
}