Skip to content

Commit 9d11c76

Browse files
authored
Added start-up logging of document URL caching (#19538)
Added startup logging of document URL caching.
1 parent da9c6e2 commit 9d11c76

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/Umbraco.Core/Services/DocumentUrlService.cs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,14 +141,18 @@ public async Task InitAsync(bool forceEmpty, CancellationToken cancellationToken
141141
using ICoreScope scope = _coreScopeProvider.CreateCoreScope();
142142
if (ShouldRebuildUrls())
143143
{
144-
_logger.LogInformation("Rebuilding all URLs.");
144+
_logger.LogInformation("Rebuilding all document URLs.");
145145
await RebuildAllUrlsAsync();
146146
}
147147

148+
_logger.LogInformation("Caching document URLs.");
149+
148150
IEnumerable<PublishedDocumentUrlSegment> publishedDocumentUrlSegments = _documentUrlRepository.GetAll();
149151

150152
IEnumerable<ILanguage> languages = await _languageService.GetAllAsync();
151153
var languageIdToIsoCode = languages.ToDictionary(x => x.Id, x => x.IsoCode);
154+
155+
int numberOfCachedUrls = 0;
152156
foreach (PublishedDocumentUrlSegments publishedDocumentUrlSegment in ConvertToCacheModel(publishedDocumentUrlSegments))
153157
{
154158
if (cancellationToken.IsCancellationRequested)
@@ -159,9 +163,12 @@ public async Task InitAsync(bool forceEmpty, CancellationToken cancellationToken
159163
if (languageIdToIsoCode.TryGetValue(publishedDocumentUrlSegment.LanguageId, out var isoCode))
160164
{
161165
UpdateCache(_coreScopeProvider.Context!, publishedDocumentUrlSegment, isoCode);
166+
numberOfCachedUrls++;
162167
}
163168
}
164169

170+
_logger.LogInformation("Cached {NumberOfUrls} document URLs.", numberOfCachedUrls);
171+
165172
_isInitialized = true;
166173
scope.Complete();
167174
}

0 commit comments

Comments
 (0)