Beispiel #1
0
        protected override async Task RunInternalAsync(CancellationToken cancellationToken)
        {
            using (Logger.BeginScope($"Logging for {{{TelemetryConstants.Destination}}}", _destination))
                using (TelemetryService.TrackDuration(TelemetryConstants.JobLoopSeconds))
                    using (var indexWriter = CreateIndexWriter(_directory))
                    {
                        var collector = new SearchIndexFromCatalogCollector(
                            index: new Uri(_source),
                            indexWriter: indexWriter,
                            commitEachBatch: false,
                            commitTimeout: _commitTimeout,
                            baseAddress: _catalogBaseAddress,
                            telemetryService: TelemetryService,
                            logger: Logger,
                            handlerFunc: _handlerFunc);

                        ReadWriteCursor front = new LuceneCursor(indexWriter, MemoryCursor.MinValue);
                        var             back  = _registration == null
                                 ? (ReadCursor)MemoryCursor.CreateMax()
                                 : GetTheLeastAdvancedRegistrationCursor(_registration, cancellationToken);

                        bool run;
                        do
                        {
                            run = await collector.RunAsync(front, back, cancellationToken);

                            await collector.EnsureCommittedAsync(); // commit after each catalog page
                        }while (run);
                    }
        }
        protected override async Task RunInternal(CancellationToken cancellationToken)
        {
            using (var indexWriter = CreateIndexWriter(_directory))
            {
                var collector = new SearchIndexFromCatalogCollector(
                    Logger,
                    index: new Uri(_source),
                    indexWriter: indexWriter,
                    commitEachBatch: false,
                    baseAddress: _catalogBaseAddress,
                    handlerFunc: _handlerFunc);

                ReadWriteCursor front = new LuceneCursor(indexWriter, MemoryCursor.MinValue);

                var back = _registration == null
                    ? (ReadCursor)MemoryCursor.CreateMax()
                    : new HttpReadCursor(new Uri(_registration), _handlerFunc);

                bool run;
                do
                {
                    run = await collector.Run(front, back, cancellationToken);

                    collector.EnsureCommitted(); // commit after each catalog page
                }
                while (run);
            }
        }