public DataExtractor(DataExtractorConfiguration configuration, PostgreSqlDbContext dbContext, IBetsApiClient betsApiClient) { _configuration = configuration ?? throw new ArgumentNullException(nameof(configuration)); _dbContext = dbContext ?? throw new ArgumentNullException(nameof(dbContext)); _betsApiClient = betsApiClient ?? throw new ArgumentNullException(nameof(betsApiClient)); }
public RealTimeRetriever(IBetsApiClient betsApiClient, IEventsRepository eventsRepository, RealTimeRetrieverConfiguration configuration, Func <PostgreSqlDbContext> dbContextAccessor) { _betsApiClient = betsApiClient ?? throw new ArgumentNullException(nameof(betsApiClient)); _eventsRepository = eventsRepository ?? throw new ArgumentNullException(nameof(eventsRepository)); _configuration = configuration ?? throw new ArgumentNullException(nameof(configuration)); _dbContextAccessor = dbContextAccessor ?? throw new ArgumentNullException(nameof(dbContextAccessor)); }
public BetsApiClient(string betsApiUrl) { _betsApiClient = RestClient.For <IBetsApiClient>(betsApiUrl); _retryPolicy = Policy .Handle <Exception>(e => e is ApiException || e is HttpRequestException) .WaitAndRetryForeverAsync(retryAttempt => { var secondsToWait = Math.Pow(retryAttempt, 2); secondsToWait = Math.Min(secondsToWait, MAX_SECONDS_TO_WAIT); return(TimeSpan.FromSeconds(secondsToWait)); }); }