コード例 #1
0
        /// <summary>
        /// Ищет сборки по биндингам.
        /// </summary>
        /// <param name="buildSyncService">Сервис синхронизации.</param>
        /// <param name="bindings">Биндинги.</param>
        /// <returns><placeholder>A <see cref="Task"/> representing the asynchronous operation.</placeholder></returns>
        public static async Task <IEnumerable <BuildDto> > ParseBuilds(
            this IBuildSyncService buildSyncService,
            IEnumerable <BuildsBinding> bindings)
        {
            List <Task <ParseBuildsResponse> > tasks =
                bindings
                .Select(b => buildSyncService.ParseBuilds(b.Path, b.SourceType, b.Pattern.Regexp))
                .ToList();

            ParseBuildsResponse[] messages = await Task.WhenAll(tasks);

            return(messages.SelectMany(s => s.Builds));
        }
コード例 #2
0
        /// <inheritdoc />
        public async Task <IEnumerable <BuildDto> > ParseBuilds(BuildsBinding[] buildBindings, string userId, PerformContext context)
        {
            string jobId = context.BackgroundJob.Id;

            logger.LogInformation($"Try parse builds for {buildBindings.Select(x => $"{x}")}. UserId: ${userId}. JobId: ${jobId}");
            await mediator.Publish(CreateBuildParseNotification(jobId, userId, 0));

            IEnumerable <BuildDto> buildsDto = await buildSyncService.ParseBuilds(buildBindings);

            await mediator.Publish(CreateBuildParseNotification(jobId, userId, 100));

            logger.LogInformation($"Parsed {buildsDto.Count()} builds successfully!. UserId: ${userId}. JobId: ${jobId}");

            return(buildsDto);
        }