示例#1
0
        private void Downloader_FetchCompleted(object Sender, FetchCompleteEventArgs args)
        {
            try
            {
                Cacher.GenerateCacheFor(args);
            }
            catch (IOException ex)
            {
                log.Error(ex, "Failed to generate cache with an IO Exception. Spider will be paused");
                Configuration.Paused = true;
                OnError?.Invoke(this, new ErrorEventArgs()
                {
                    Source = FetchEventArgs.EventSource.Downloader, Exception = ex
                });
            }
            catch (Exception ex)
            {
                log.Error(ex, "Failed to generate cache");
                OnError?.Invoke(this, new ErrorEventArgs()
                {
                    Source = FetchEventArgs.EventSource.Downloader, Exception = ex
                });
            }
            args.Source = FetchEventArgs.EventSource.Downloader;

            if (args.Link.MovedUri != null)
            {
                SpiderWorkData.Moved301[args.Link.MovedUri.ToString()] = args.Link.Uri.ToString();
            }

            fetchCompleted(args);
        }