Example #1
0
        public virtual async Task Execute(IJobExecutionContext context)
        {
            Logger.Information("Creating provider instance");
            Provider = await ScrapeHandlerFactory.CreateAsync(ProviderType, Logger, WebPortalHelper, ScrapeHelper);

            ModifyProvider();

            var success = false;
            int i;

            for (i = 0; i < Constants.RetryAttempt; i++)
            {
                Logger.Information($"Scrape attempt: {i + 1}");
                if (await Provider.Scrape())
                {
                    success = true;
                    break;
                }
                await Task.Delay(Constants.RetryAfter);
            }

            if (success)
            {
                Logger.Information($"Scrape succeeded after {i + 1} attempt(s)");
            }
            else
            {
                Logger.Error($"Scrape failed after {Constants.RetryAttempt} attempts");
            }
        }
Example #2
0
        private static async Task Main()
        {
            //Create scrape handler instance to run
            var provider = await ScrapeHandlerFactory.CreateAsync(typeof(TopSportPlayerOverUnder));

            //var provider = ScrapeHandlerFactory.Create<EspnCompetition>();
            await provider.Scrape();
        }