private void DoProcesser()
        {
            while (!_isProcesserThreadStop)
            {
                if (_downloadResultQueue.IsEmpty)
                {
                    Thread.Sleep(100);
                    continue;
                }

                DownloadResult downlaodResult = null;
                _downloadResultQueue.TryDequeue(out downlaodResult);
                if (null == downlaodResult)
                {
                    continue;
                }

                try {
                    var urls = downlaodResult.FindAllUrls();
                    OnFindAllUrls?.Invoke(urls);
                    OnResultToPipeline?.Invoke(downlaodResult);
                } catch (Exception e) {
                    _exceptionDownoadResult.Add(downlaodResult);
                    Console.WriteLine(new { DownloadResult = downlaodResult, Exception = e });
                }

                Thread.Sleep(0);
            }
        }
Пример #2
0
        public override void Extract(DownloadResult previousResult)
        {
            var urls = previousResult.FindAllUrls();

            _onResult(urls);
        }