/// <summary> /// Registers/Adds work to the <see cref="CrawlerWorkSource"/>. /// </summary> /// <param name="work"><see cref="ICrawlerWork"/></param> public void RegisterWork(IWork work) { if (work.IsReadyToStart()) { availableWork.Enqueue(work); } else { workSourceScheduler.ScheduleWork(work); } }
/// <summary> /// Returns <see cref="ICrawlerWork"/> to the current <see cref="CrawlerWorkSource"/> for rescheduling. /// </summary> /// <param name="work"></param> public void ReturnFinishedWork(IWork work) { if (!IsSourceReleased) { if (work.IsReadyToStart()) { availableWork.Enqueue(work); NotifyFreeCrawler(); } else { workSourceScheduler.ScheduleWork(work); } } }