private const int FALLBACK_DELAY = 1; // 0 gives issues with json-server public async Task GetAllPostsWithRetry() { try { _logger.Write(Program.SEPARATOR); _logger.Write($"Getting all posts with retry"); var posts = await _pollyService.GetWithPolicy <IEnumerable <Post> >( PolicyTypes.Retry, () => _remoteApiService.GetAllPostsAsync(DELAY), null).ConfigureAwait(false); _logger.Write($"result count: {posts.Count()}"); } catch (Exception) { _logger.Write("Expected exception, timeout"); } }
public async Task GetAllPosts() { _logger.Write(Program.SEPARATOR); _logger.Write($"Getting all posts"); var allPosts = await _remoteApiService.GetAllPostsAsync(DELAY).ConfigureAwait(false); _logger.Write($"AllPosts result count: {allPosts.Count()}"); }