From 4be183a20d36e1ddb02627a80fb32cde7e8e601e Mon Sep 17 00:00:00 2001 From: Bjarke Berg Date: Mon, 21 Oct 2024 09:49:34 +0200 Subject: [PATCH] Do not rely on NuCache to do key/id lookups (#17291) * Fixes #17182 * Ensure wait-on is installed --- build/azure-pipelines.yml | 4 ++++ .../UmbracoBuilderExtensions.cs | 18 +----------------- 2 files changed, 5 insertions(+), 17 deletions(-) diff --git a/build/azure-pipelines.yml b/build/azure-pipelines.yml index dc5ef96bde56..2ec84196b002 100644 --- a/build/azure-pipelines.yml +++ b/build/azure-pipelines.yml @@ -506,6 +506,10 @@ stages: condition: and(succeeded(), eq(variables['Agent.OS'], 'Windows_NT')) workingDirectory: $(Agent.BuildDirectory)/app + # Ensures we have the package wait-on installed + - pwsh: npm install wait-on + displayName: Install wait-on package + # Wait for application to start responding to requests - pwsh: npx wait-on -v --interval 1000 --timeout 120000 $(ASPNETCORE_URLS) displayName: Wait for application diff --git a/src/Umbraco.PublishedCache.NuCache/DependencyInjection/UmbracoBuilderExtensions.cs b/src/Umbraco.PublishedCache.NuCache/DependencyInjection/UmbracoBuilderExtensions.cs index 0c1042c3ffe4..862bbb9abc93 100644 --- a/src/Umbraco.PublishedCache.NuCache/DependencyInjection/UmbracoBuilderExtensions.cs +++ b/src/Umbraco.PublishedCache.NuCache/DependencyInjection/UmbracoBuilderExtensions.cs @@ -37,23 +37,7 @@ public static IUmbracoBuilder AddNuCache(this IUmbracoBuilder builder) builder.Services.TryAddSingleton(); builder.Services.TryAddTransient(); - // replace this service since we want to improve the content/media - // mapping lookups if we are using nucache. - // TODO: Gotta wonder how much this does actually improve perf? It's a lot of weird code to make this happen so hope it's worth it - builder.Services.AddUnique(factory => - { - var idkSvc = new IdKeyMap( - factory.GetRequiredService(), - factory.GetRequiredService()); - if (factory.GetRequiredService() is PublishedSnapshotService - publishedSnapshotService) - { - idkSvc.SetMapper(UmbracoObjectTypes.Document, id => publishedSnapshotService.GetDocumentUid(id), uid => publishedSnapshotService.GetDocumentId(uid)); - idkSvc.SetMapper(UmbracoObjectTypes.Media, id => publishedSnapshotService.GetMediaUid(id), uid => publishedSnapshotService.GetMediaId(uid)); - } - - return idkSvc; - }); + builder.Services.AddUnique(); builder.AddNuCacheNotifications();