fix support for non run states
This commit is contained in:
@@ -17,19 +17,4 @@ namespace Umbraco.Core.Sync
|
||||
/// <returns></returns>
|
||||
SyncBootState GetSyncBootState();
|
||||
}
|
||||
public enum SyncBootState
|
||||
{
|
||||
/// <summary>
|
||||
/// Unknown state. Treat as HasSyncState
|
||||
/// </summary>
|
||||
Unknown = 0,
|
||||
/// <summary>
|
||||
/// Cold boot. No Sync state
|
||||
/// </summary>
|
||||
ColdBoot = 1,
|
||||
/// <summary>
|
||||
/// Warm boot. Sync state present
|
||||
/// </summary>
|
||||
HasSyncState = 2
|
||||
}
|
||||
}
|
||||
|
||||
19
src/Umbraco.Core/Sync/NonRuntimeLevelBootStateAccessor.cs
Normal file
19
src/Umbraco.Core/Sync/NonRuntimeLevelBootStateAccessor.cs
Normal file
@@ -0,0 +1,19 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Umbraco.Core.Sync
|
||||
{
|
||||
/// <summary>
|
||||
/// Boot state implementation for when umbraco is not in the run state
|
||||
/// </summary>
|
||||
public class NonRuntimeLevelBootStateAccessor : ISyncBootStateAccessor
|
||||
{
|
||||
public SyncBootState GetSyncBootState()
|
||||
{
|
||||
return SyncBootState.Unknown;
|
||||
}
|
||||
}
|
||||
}
|
||||
24
src/Umbraco.Core/Sync/SyncBootState.cs
Normal file
24
src/Umbraco.Core/Sync/SyncBootState.cs
Normal file
@@ -0,0 +1,24 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Umbraco.Core.Sync
|
||||
{
|
||||
public enum SyncBootState
|
||||
{
|
||||
/// <summary>
|
||||
/// Unknown state. Treat as HasSyncState
|
||||
/// </summary>
|
||||
Unknown = 0,
|
||||
/// <summary>
|
||||
/// Cold boot. No Sync state
|
||||
/// </summary>
|
||||
ColdBoot = 1,
|
||||
/// <summary>
|
||||
/// Warm boot. Sync state present
|
||||
/// </summary>
|
||||
HasSyncState = 2
|
||||
}
|
||||
}
|
||||
@@ -174,6 +174,8 @@
|
||||
<Compile Include="Services\IInstallationService.cs" />
|
||||
<Compile Include="Services\IUpgradeService.cs" />
|
||||
<Compile Include="Sync\ISyncBootStateAccessor.cs" />
|
||||
<Compile Include="Sync\NonRuntimeLevelBootStateAccessor.cs" />
|
||||
<Compile Include="Sync\SyncBootState.cs" />
|
||||
<Compile Include="SystemLock.cs" />
|
||||
<Compile Include="Attempt.cs" />
|
||||
<Compile Include="AttemptOfTResult.cs" />
|
||||
|
||||
@@ -72,7 +72,7 @@ namespace Umbraco.Web.Compose
|
||||
|
||||
composition.SetDatabaseServerMessengerOptions(GetDefaultOptions);
|
||||
composition.SetServerMessenger<BatchedDatabaseServerMessenger>();
|
||||
composition.Register<ISyncBootStateAccessor, BatchedDatabaseServerMessenger>(Lifetime.Singleton);
|
||||
composition.Register<ISyncBootStateAccessor>(factory=> factory.GetInstance<IServerMessenger>() as BatchedDatabaseServerMessenger, Lifetime.Singleton);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
using Umbraco.Core;
|
||||
using Umbraco.Core.Composing;
|
||||
using Umbraco.Core.Sync;
|
||||
using Umbraco.Web.PublishedCache.NuCache.DataSource;
|
||||
|
||||
namespace Umbraco.Web.PublishedCache.NuCache
|
||||
@@ -10,6 +11,9 @@ namespace Umbraco.Web.PublishedCache.NuCache
|
||||
{
|
||||
base.Compose(composition);
|
||||
|
||||
//Overriden on Run state in DatabaseServerRegistrarAndMessengerComposer
|
||||
composition.Register<ISyncBootStateAccessor, NonRuntimeLevelBootStateAccessor>(Lifetime.Singleton);
|
||||
|
||||
// register the NuCache database data source
|
||||
composition.Register<IDataSource, DatabaseDataSource>();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user