Ejemplo n.º 1
0
        private void ReloadAuxiliaryDataIfExpired()
        {
            if (LastAuxiliaryDataLoadTime == null || LastAuxiliaryDataLoadTime < DateTime.UtcNow - _auxiliaryDataRefreshRate)
            {
                IndexingUtils.Load(AuxiliaryFiles.Owners, _loader, _logger, _owners);
                IndexingUtils.Load(AuxiliaryFiles.CuratedFeeds, _loader, _logger, _curatedFeeds);
                _downloads.Load(AuxiliaryFiles.DownloadsV1, _loader, _logger);
                _rankings             = DownloadRankings.Load(AuxiliaryFiles.RankingsV1, _loader, _logger);
                _queryBoostingContext = QueryBoostingContext.Load(AuxiliaryFiles.SearchSettingsV1, _loader, _logger);
                _verifiedPackages     = VerifiedPackages.Load(AuxiliaryFiles.VerifiedPackages, _loader, _logger);

                LastAuxiliaryDataLoadTime = DateTime.UtcNow;
                AuxiliaryFiles.UpdateLastModifiedTime();
            }
        }
Ejemplo n.º 2
0
        public NuGetSearcherManager(FrameworkLogger logger,
                                    IIndexDirectoryProvider indexProvider,
                                    ILoader loader,
                                    int auxiliaryDataRefreshRateSec,
                                    int indexReloadRateSec)
        {
            if (logger == null)
            {
                throw new ArgumentNullException(nameof(logger));
            }

            _logger = logger;

            RegistrationBaseAddresses = new RegistrationBaseAddresses();

            _indexProvider = indexProvider;
            _loader        = loader;

            AuxiliaryFiles = new AuxiliaryFiles(_loader);

            _indexReloadRate          = TimeSpan.FromSeconds(indexReloadRateSec);
            _auxiliaryDataRefreshRate = TimeSpan.FromSeconds(auxiliaryDataRefreshRateSec);
        }