Пример #1
0
            public static void ResumeIndexers(ExamineIndexRebuilder backgroundIndexRebuilder)
            {
                s_suspended = false;

                StaticApplicationLogging.Logger.LogInformation("Resume indexers (rebuild:{Tried}).", s_tried);

                if (s_tried == false)
                {
                    return;
                }

                s_tried = false;

                backgroundIndexRebuilder.RebuildIndexes(false);
            }
    /// <summary>
    ///     On first http request schedule an index rebuild for any empty indexes (or all if it's a cold boot)
    /// </summary>
    /// <param name="notification"></param>
    public void Handle(UmbracoRequestBeginNotification notification)
    {
        if (_runtimeState.Level != RuntimeLevel.Run)
        {
            return;
        }

        LazyInitializer.EnsureInitialized(
            ref _isReady,
            ref _isReadSet,
            ref _isReadyLock,
            () =>
        {
            SyncBootState bootState = _syncBootStateAccessor.GetSyncBootState();

            // if it's not a cold boot, only rebuild empty ones
            _backgroundIndexRebuilder.RebuildIndexes(
                bootState != SyncBootState.ColdBoot,
                TimeSpan.FromMinutes(1));

            return(true);
        });
    }