* Added new notification to hook in after the premigrations and use this to init different services. * Force MaxDegreeOfParallelism to 1, while investigating scopes * Tried some more workarounds * Updated scopes and changed parallel to non parallel to ensure migration works * Missing scope * Make it parallel again - The secret is, the SuppressFlow needs to be when you create the task, but not on the await!. * Fixed issue when DEBUG_SCOPES is not added to tests. * Remove test exception * Try build on ubuntu again, even that we know it can be stuck. Just a test to see if all tests pass * Updated comment --------- Co-authored-by: kjac <kja@umbraco.dk>
30 lines
1.0 KiB
C#
30 lines
1.0 KiB
C#
using Umbraco.Cms.Core.Events;
|
|
using Umbraco.Cms.Core.Notifications;
|
|
|
|
namespace Umbraco.Cms.Core.Services;
|
|
|
|
public class DocumentUrlServiceInitializerNotificationHandler : INotificationAsyncHandler<UmbracoApplicationStartingNotification>
|
|
{
|
|
private readonly IDocumentUrlService _documentUrlService;
|
|
private readonly IRuntimeState _runtimeState;
|
|
|
|
public DocumentUrlServiceInitializerNotificationHandler(IDocumentUrlService documentUrlService, IRuntimeState runtimeState)
|
|
{
|
|
_documentUrlService = documentUrlService;
|
|
_runtimeState = runtimeState;
|
|
}
|
|
|
|
public async Task HandleAsync(UmbracoApplicationStartingNotification notification, CancellationToken cancellationToken)
|
|
{
|
|
if (_runtimeState.Level == RuntimeLevel.Upgrade)
|
|
{
|
|
//Special case on the first upgrade, as the database is not ready yet.
|
|
return;
|
|
}
|
|
|
|
await _documentUrlService.InitAsync(
|
|
_runtimeState.Level <= RuntimeLevel.Install,
|
|
cancellationToken);
|
|
}
|
|
}
|