Example #1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="BackgroundScraperService"/> class.
        /// </summary>
        /// <param name="logger">The logger scoped to this service.</param>
        /// <param name="services">Services provider.</param>
        /// <param name="apiClient">The client to access the api.</param>
        public BackgroundScraperService(ILogger <BackgroundScraperService> logger, IServiceProvider services, ApiClient.IApiClient apiClient)
        {
            _logger      = logger;
            _services    = services;
            _apiClient   = apiClient;
            _retryPolicy = Policy
                           .Handle <HttpRequestException>()
                           .WaitAndRetryAsync(10, (i) =>
            {
                if (i >= 10)
                {
                    return(TimeSpan.FromSeconds(120));
                }

                return(TimeSpan.FromSeconds(i * i));
            });
        }
Example #2
0
 public ShipmentController(ApiClient.IApiClient apiClient)
 {
     _apiClient = apiClient;
 }