Пример #1
0
        private void UmbracoModule_RouteAttempt(object sender, RoutableAttemptEventArgs e)
        {
            if (!_initialized)
            {
                lock (_locker)
                {
                    // double check lock, we must only do this once
                    if (!_initialized)
                    {
                        _initialized = true;

                        UmbracoModule.RouteAttempt -= UmbracoModule_RouteAttempt;

                        if (!_mainDom.IsMainDom)
                        {
                            return;
                        }

                        var bootState = _syncBootStateAccessor.GetSyncBootState();

                        _examineManager.ConfigureIndexes(_mainDom, _logger);

                        // if it's a cold boot, rebuild all indexes including non-empty ones
                        // delay one minute since a cold boot also triggers nucache rebuilds
                        _indexRebuilder.RebuildIndexes(bootState != SyncBootState.ColdBoot, 60000);
                    }
                }
            }
        }
Пример #2
0
        public void Initialize()
        {
            if (!_mainDom.IsMainDom)
            {
                return;
            }

            _examineManager.ConfigureIndexes(_mainDom, _logger);

            // TODO: Instead of waiting 5000 ms, we could add an event handler on to fulfilling the first request, then start?
            _indexRebuilder.RebuildIndexes(true, 5000);
        }