Skip to content

Commit

Permalink
Do not rely on NuCache to do key/id lookups (#17291)
Browse files Browse the repository at this point in the history
* Fixes #17182

* Ensure wait-on is installed
  • Loading branch information
bergmania authored Oct 21, 2024
1 parent 378d4ec commit 4be183a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 17 deletions.
4 changes: 4 additions & 0 deletions build/azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,23 +37,7 @@ public static IUmbracoBuilder AddNuCache(this IUmbracoBuilder builder)
builder.Services.TryAddSingleton<IPublishedSnapshotStatus, PublishedSnapshotStatus>();
builder.Services.TryAddTransient<IReservedFieldNamesService, ReservedFieldNamesService>();

// 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<IIdKeyMap>(factory =>
{
var idkSvc = new IdKeyMap(
factory.GetRequiredService<ICoreScopeProvider>(),
factory.GetRequiredService<IIdKeyMapRepository>());
if (factory.GetRequiredService<IPublishedSnapshotService>() 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<IIdKeyMap, IdKeyMap>();

builder.AddNuCacheNotifications();

Expand Down

0 comments on commit 4be183a

Please sign in to comment.