protected override Task ProcessGraphs(KeyValuePair <string, IDictionary <string, IGraph> > sortedGraphs)
 {
     return(RegistrationMaker.Process(
                new RegistrationKey(sortedGraphs.Key),
                sortedGraphs.Value,
                _storageFactory,
                ContentBaseAddress,
                PartitionSize,
                PackageCountThreshold));
 }
Пример #2
0
        protected override async Task ProcessGraphsAsync(
            KeyValuePair <string, IReadOnlyDictionary <string, IGraph> > sortedGraphs,
            CancellationToken cancellationToken)
        {
            var tasks = new List <Task>();

            using (_telemetryService.TrackDuration(TelemetryConstants.ProcessGraphsSeconds,
                                                   new Dictionary <string, string>()
            {
                { TelemetryConstants.Id, sortedGraphs.Key.ToLowerInvariant() }
            }))
            {
                var legacyTask = RegistrationMaker.ProcessAsync(
                    registrationKey: new RegistrationKey(sortedGraphs.Key),
                    newItems: sortedGraphs.Value,
                    shouldInclude: _shouldIncludeSemVer2ForLegacyStorageFactory,
                    storageFactory: _legacyStorageFactory,
                    postProcessGraph: _postProcessGraphForLegacyStorageFactory,
                    contentBaseAddress: ContentBaseAddress,
                    galleryBaseAddress: GalleryBaseAddress,
                    partitionSize: PartitionSize,
                    packageCountThreshold: PackageCountThreshold,
                    forcePackagePathProviderForIcons: _forcePackagePathProviderForIcons,
                    telemetryService: _telemetryService,
                    cancellationToken: cancellationToken);
                tasks.Add(legacyTask);

                if (_semVer2StorageFactory != null)
                {
                    var semVer2Task = RegistrationMaker.ProcessAsync(
                        registrationKey: new RegistrationKey(sortedGraphs.Key),
                        newItems: sortedGraphs.Value,
                        storageFactory: _semVer2StorageFactory,
                        contentBaseAddress: ContentBaseAddress,
                        galleryBaseAddress: GalleryBaseAddress,
                        partitionSize: PartitionSize,
                        packageCountThreshold: PackageCountThreshold,
                        forcePackagePathProviderForIcons: _forcePackagePathProviderForIcons,
                        telemetryService: _telemetryService,
                        cancellationToken: cancellationToken);
                    tasks.Add(semVer2Task);
                }

                await Task.WhenAll(tasks);
            }
        }