Added start-up logging of document URL caching (#19538)
Added startup logging of document URL caching.
This commit is contained in:
@@ -141,14 +141,18 @@ public class DocumentUrlService : IDocumentUrlService
|
||||
using ICoreScope scope = _coreScopeProvider.CreateCoreScope();
|
||||
if (ShouldRebuildUrls())
|
||||
{
|
||||
_logger.LogInformation("Rebuilding all URLs.");
|
||||
_logger.LogInformation("Rebuilding all document URLs.");
|
||||
await RebuildAllUrlsAsync();
|
||||
}
|
||||
|
||||
_logger.LogInformation("Caching document URLs.");
|
||||
|
||||
IEnumerable<PublishedDocumentUrlSegment> publishedDocumentUrlSegments = _documentUrlRepository.GetAll();
|
||||
|
||||
IEnumerable<ILanguage> languages = await _languageService.GetAllAsync();
|
||||
var languageIdToIsoCode = languages.ToDictionary(x => x.Id, x => x.IsoCode);
|
||||
|
||||
int numberOfCachedUrls = 0;
|
||||
foreach (PublishedDocumentUrlSegments publishedDocumentUrlSegment in ConvertToCacheModel(publishedDocumentUrlSegments))
|
||||
{
|
||||
if (cancellationToken.IsCancellationRequested)
|
||||
@@ -159,9 +163,12 @@ public class DocumentUrlService : IDocumentUrlService
|
||||
if (languageIdToIsoCode.TryGetValue(publishedDocumentUrlSegment.LanguageId, out var isoCode))
|
||||
{
|
||||
UpdateCache(_coreScopeProvider.Context!, publishedDocumentUrlSegment, isoCode);
|
||||
numberOfCachedUrls++;
|
||||
}
|
||||
}
|
||||
|
||||
_logger.LogInformation("Cached {NumberOfUrls} document URLs.", numberOfCachedUrls);
|
||||
|
||||
_isInitialized = true;
|
||||
scope.Complete();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user