示例#1
0
        protected async Task <IEnumerable <CatalogCommit> > FetchCatalogCommitsAsync(
            CollectorHttpClient client,
            ReadCursor front,
            ReadCursor back,
            CancellationToken cancellationToken)
        {
            JObject root;

            using (_telemetryService.TrackDuration(
                       TelemetryConstants.CatalogIndexReadDurationSeconds,
                       new Dictionary <string, string>()
            {
                { TelemetryConstants.Uri, Index.AbsoluteUri }
            }))
            {
                root = await client.GetJObjectAsync(Index, cancellationToken);
            }

            var commits = root["items"].Select(item => CatalogCommit.Create((JObject)item));

            return(GetCommitsInRange(commits, front.Value, back.Value));
        }
        protected async Task <IEnumerable <CatalogCommit> > FetchCatalogCommitsAsync(
            CollectorHttpClient client,
            ReadWriteCursor front,
            CancellationToken cancellationToken)
        {
            JObject root;

            using (_telemetryService.TrackDuration(
                       TelemetryConstants.CatalogIndexReadDurationSeconds,
                       new Dictionary <string, string>()
            {
                { TelemetryConstants.Uri, Index.AbsoluteUri }
            }))
            {
                root = await client.GetJObjectAsync(Index, cancellationToken);
            }

            IEnumerable <CatalogCommit> commits = root["items"]
                                                  .Select(item => CatalogCommit.Create((JObject)item))
                                                  .Where(item => item.CommitTimeStamp > front.Value)
                                                  .OrderBy(item => item.CommitTimeStamp);

            return(commits);
        }