From 634eecb91285d4d94750173356092f13008595da Mon Sep 17 00:00:00 2001 From: Cristian Petruta Date: Thu, 11 Jul 2019 20:28:31 -0700 Subject: [PATCH] Performance improvement for repository merge step --- src/library/Storage/UpdatesCache.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/library/Storage/UpdatesCache.cs b/src/library/Storage/UpdatesCache.cs index ea6c1b4..ae66d16 100644 --- a/src/library/Storage/UpdatesCache.cs +++ b/src/library/Storage/UpdatesCache.cs @@ -203,6 +203,7 @@ namespace Microsoft.UpdateServices.Storage var parentRepositoryInternal = ParentRepository as IRepositoryInternal; List newBundlingUpdates = new List(); + List addedUpdates = new List(); foreach (var newUpdate in queryResult.Updates) { @@ -212,6 +213,7 @@ namespace Microsoft.UpdateServices.Storage newUpdate.LastChanged = DateTime.Now; Index.Add(newUpdate.Identity, newUpdate); + addedUpdates.Add(newUpdate); using (var newMetadataStream = File.OpenRead(queryResult.GetUpdateXmlPath(newUpdate))) { @@ -268,7 +270,8 @@ namespace Microsoft.UpdateServices.Storage var productsList = categories.Products.Values.ToList(); var classificationsList = categories.Classifications.Values.ToList(); - foreach (var update in Index.Values) + // Fill in product and classification information. + foreach (var update in addedUpdates) { var updateWithProduct = update as IUpdateWithProductInternal; if (updateWithProduct != null)