コード例 #1
0
        private async Task ReRunWith(SrStoredEpisodePhases?phase, string?state, CancellationToken stoppingToken)
        {
            var allErrorEpisodes = await _storage.GetEpisodesWithStatus(phase?.ToString(), state);

            if (!allErrorEpisodes.Any())
            {
                return;
            }

            var episodeInfos = await _sverigesRadioApiClient.GetEpisodesAsync(allErrorEpisodes.Select(x => x.EpisodeId).ToList(), ListPagination.TakeFirst(allErrorEpisodes.Count));

            var ids = new StringBuilder();

            foreach (var episode in episodeInfos.Episodes.OrderBy(x => x.PublishDateUtc))
            {
                await _storage.DeleteEpisodeStatus(episode.Id);

                await _storage.DeleteStoredEpisode(episode.Id);

                _logger.LogInformation($"Deleting {episode.Id} - {episode.PublishDateUtc} - {episode.Title}...");
            }

            await _srWorker.Work(allErrorEpisodes.Select(x => x.EpisodeId).ToList(), true, stoppingToken);
        }
コード例 #2
0
 public async Task Run([TimerTrigger("*/15 * * * *", RunOnStartup = true)] TimerInfo myTimer, ILogger log, CancellationToken cancellationToken)
 {
     log.LogInformation($"CrawlSrEpisodes executed at: {DateTime.Now}");
     await _srWorker.Work(SrPrograms, false, cancellationToken);
 }