using Umbraco.Cms.Core.Services;
namespace Umbraco.Cms.Core.Composing;
///
///
/// By default, the component will not execute if Umbraco is restarting or the runtime level is not .
///
public abstract class RuntimeAsyncComponentBase : AsyncComponentBase
{
private readonly IRuntimeState _runtimeState;
///
/// Initializes a new instance of the class.
///
/// State of the Umbraco runtime.
protected RuntimeAsyncComponentBase(IRuntimeState runtimeState)
=> _runtimeState = runtimeState;
///
protected override bool CanExecute(bool isRestarting)
=> base.CanExecute(isRestarting) && _runtimeState.Level == RuntimeLevel.Run;
}