RebuildOnStartupHandler should not inject ExamineIndexRebuilder, but only the interface (#15465)
This commit is contained in:
@@ -57,7 +57,9 @@ public static partial class UmbracoBuilderExtensions
|
||||
builder.Services.AddUnique<IDeliveryApiContentIndexFieldDefinitionBuilder, DeliveryApiContentIndexFieldDefinitionBuilder>();
|
||||
builder.Services.AddUnique<IDeliveryApiContentIndexHelper, DeliveryApiContentIndexHelper>();
|
||||
builder.Services.AddSingleton<IDeliveryApiIndexingHandler, DeliveryApiIndexingHandler>();
|
||||
builder.Services.AddSingleton<ExamineIndexRebuilder>();
|
||||
|
||||
builder.Services.AddSingleton<ExamineIndexRebuilder>(); //TODO remove in Umbraco 15. Only the interface should be in the service provider
|
||||
|
||||
builder.Services.AddUnique<IDeliveryApiCompositeIdHandler, DeliveryApiCompositeIdHandler>();
|
||||
|
||||
builder.AddNotificationHandler<ContentCacheRefresherNotification, ContentIndexingNotificationHandler>();
|
||||
|
||||
@@ -10,6 +10,7 @@ using Umbraco.Cms.Infrastructure.HostedServices;
|
||||
|
||||
namespace Umbraco.Cms.Infrastructure.Examine;
|
||||
|
||||
[Obsolete("This will be removed in Umbraco 15. Use IIndexRebuilder instead.")] // Main reason for this is to remove it form the service container. Maybe even make this internal
|
||||
public class ExamineIndexRebuilder : IIndexRebuilder
|
||||
{
|
||||
private readonly IBackgroundTaskQueue _backgroundTaskQueue;
|
||||
|
||||
@@ -24,17 +24,38 @@ public sealed class RebuildOnStartupHandler : INotificationHandler<UmbracoReques
|
||||
private static bool _isReady;
|
||||
private static bool _isReadSet;
|
||||
private static object? _isReadyLock;
|
||||
private readonly ExamineIndexRebuilder _backgroundIndexRebuilder;
|
||||
private readonly IRuntimeState _runtimeState;
|
||||
private readonly ISyncBootStateAccessor _syncBootStateAccessor;
|
||||
private readonly IIndexRebuilder _indexRebuilder;
|
||||
|
||||
[Obsolete("Use non-obsolete constructor. This is scheduled for removal in Umbraco 15.")]
|
||||
public RebuildOnStartupHandler(
|
||||
ISyncBootStateAccessor syncBootStateAccessor,
|
||||
ExamineIndexRebuilder backgroundIndexRebuilder,
|
||||
IRuntimeState runtimeState)
|
||||
: this(syncBootStateAccessor, (IIndexRebuilder) backgroundIndexRebuilder, runtimeState)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
[Obsolete("Use non-obsolete constructor. This is scheduled for removal in Umbraco 15.")]
|
||||
public RebuildOnStartupHandler(
|
||||
ISyncBootStateAccessor syncBootStateAccessor,
|
||||
ExamineIndexRebuilder backgroundIndexRebuilder,
|
||||
IIndexRebuilder indexRebuilder,
|
||||
IRuntimeState runtimeState)
|
||||
: this(syncBootStateAccessor, indexRebuilder, runtimeState)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public RebuildOnStartupHandler(
|
||||
ISyncBootStateAccessor syncBootStateAccessor,
|
||||
IIndexRebuilder indexRebuilder,
|
||||
IRuntimeState runtimeState)
|
||||
{
|
||||
_syncBootStateAccessor = syncBootStateAccessor;
|
||||
_backgroundIndexRebuilder = backgroundIndexRebuilder;
|
||||
_indexRebuilder = indexRebuilder;
|
||||
_runtimeState = runtimeState;
|
||||
}
|
||||
|
||||
@@ -58,7 +79,7 @@ public sealed class RebuildOnStartupHandler : INotificationHandler<UmbracoReques
|
||||
SyncBootState bootState = _syncBootStateAccessor.GetSyncBootState();
|
||||
|
||||
// if it's not a cold boot, only rebuild empty ones
|
||||
_backgroundIndexRebuilder.RebuildIndexes(
|
||||
_indexRebuilder.RebuildIndexes(
|
||||
bootState != SyncBootState.ColdBoot,
|
||||
TimeSpan.FromMinutes(1));
|
||||
|
||||
|
||||
@@ -46,7 +46,7 @@ public static class UmbracoBuilderExtensions
|
||||
builder.Services.AddUnique(Mock.Of<IUmbracoBootPermissionChecker>());
|
||||
builder.Services.AddUnique(testHelper.MainDom);
|
||||
|
||||
builder.Services.AddUnique<ExamineIndexRebuilder, TestBackgroundIndexRebuilder>();
|
||||
builder.Services.AddUnique<IIndexRebuilder, TestBackgroundIndexRebuilder>();
|
||||
builder.Services.AddUnique(factory => Mock.Of<IRuntimeMinifier>());
|
||||
|
||||
// we don't want persisted nucache files in tests
|
||||
|
||||
Reference in New Issue
Block a user