Beispiel #1
0
        public void ScheduleJob_ConfirmCompletion()
        {
            var result = _jobSchedulerService.ScheduleScrapeJob("http://www.google.com", string.Empty);

            //sleep for 30 seconds
            Thread.Sleep(30000);

            Assert.IsTrue(_jobSchedulerService.IsJobCompete(result));
        }
Beispiel #2
0
        public async Task <IHttpActionResult> ScrapeUrlStatus(Guid requestId)
        {
            var isComplete = await Task.Run(() => _jobSchedulerService.IsJobCompete(requestId));

            var content = await Task.Run(() => _webScrapeService.RetrieveScrapeContent(requestId));

            if (isComplete && !string.IsNullOrEmpty(content))
            {
                return(Ok(content));
            }

            return(Ok("Processing..."));
        }