public async Task ExecuteAsync() { var jobDateTime = DateTime.UtcNow; _logger.LogInformation("Adding new snapshots for torrents"); var torrentsFromClient = await _torrentClient.GetAllTorrentsAsync().ConfigureAwait(false); _logger.LogInformation("Found {0} torrents in client", torrentsFromClient.Count()); await SynchronizeTorrentDbAsync(torrentsFromClient); await AddUploadDeltaSnapshotsAsync(jobDateTime, torrentsFromClient); }
private async Task WaitUntilTorrentClientProcessedTheTorrentsAsync(List <StageTorrentDto> torrentsToStage) { await Polly .Policy .Handle <PageHelper.RetryException>() .WaitAndRetryUntilTimeoutAsync(TimeSpan.FromMilliseconds(10), TimeSpan.FromSeconds(5)) .ExecuteAsync(async() => { var torrents = await _torrentClient.GetAllTorrentsAsync().ConfigureAwait(false); if (torrents.Count() != torrentsToStage.Count) { throw new PageHelper.RetryException(); } }).ConfigureAwait(false); }
public async ValueTask <IEnumerable <Torrent> > GetAllTorrentsAsync() { return(await _torrentClient.GetAllTorrentsAsync().ConfigureAwait(false)); }