コード例 #1
0
ファイル: Crawler.cs プロジェクト: foyzulabrarchy/ncrawler
        private async Task ExecutePipeLineStep(IPipelineStep pipelineStep, PropertyBag propertyBag)
        {
            try
            {
                var sw = Stopwatch.StartNew();
                this.m_Logger.Debug("Executing pipeline step {0}", pipelineStep.GetType().Name);
                if (pipelineStep is IPipelineStepWithTimeout stepWithTimeout)
                {
                    this.m_Logger.Debug("Running pipeline step {0} with timeout {1}",
                                        pipelineStep.GetType().Name, stepWithTimeout.ProcessorTimeout);
                    this.m_TaskRunner.RunSync(async cancelArgs =>
                    {
                        if (!cancelArgs.Cancel)
                        {
                            await pipelineStep.ProcessAsync(this, propertyBag);
                        }
                    }, stepWithTimeout.ProcessorTimeout);
                }
                else
                {
                    await pipelineStep.ProcessAsync(this, propertyBag);
                }

                this.m_Logger.Debug("Executed pipeline step {0} in {1}", pipelineStep.GetType().Name, sw.Elapsed);
            }
            catch (Exception ex)
            {
                OnProcessorException(propertyBag, ex);
            }
        }
コード例 #2
0
ファイル: Crawler.cs プロジェクト: bormaxi/NCrawler
 private void ExecutePipeLineStep(IPipelineStep pipelineStep, PropertyBag propertyBag)
 {
     try
     {
         if (pipelineStep is IPipelineStepWithTimeout)
         {
             IPipelineStepWithTimeout stepWithTimeout = (IPipelineStepWithTimeout)pipelineStep;
             m_Logger.Debug("Running pipeline step {0} with timeout {1}",
                            pipelineStep.GetType().Name, stepWithTimeout.ProcessorTimeout);
             m_TaskRunner.RunSync(() => pipelineStep.Process(this, propertyBag), stepWithTimeout.ProcessorTimeout);
         }
         else
         {
             m_Logger.Debug("Running pipeline step {0}", pipelineStep.GetType().Name);
             pipelineStep.Process(this, propertyBag);
         }
     }
     catch (Exception ex)
     {
         OnProcessorException(propertyBag, ex);
     }
 }
コード例 #3
0
ファイル: Crawler.cs プロジェクト: osamede/social_listen
        private void ExecutePipeLineStep(IPipelineStep pipelineStep, PropertyBag propertyBag)
        {
            try
            {
                Stopwatch sw = Stopwatch.StartNew();
                m_Logger.Debug("Executing pipeline step {0}", pipelineStep.GetType().Name);
                if (pipelineStep is IPipelineStepWithTimeout)
                {
                    IPipelineStepWithTimeout stepWithTimeout = (IPipelineStepWithTimeout) pipelineStep;
                    m_Logger.Debug("Running pipeline step {0} with timeout {1}",
                        pipelineStep.GetType().Name, stepWithTimeout.ProcessorTimeout);
                    m_TaskRunner.RunSync(cancelArgs =>
                        {
                            if (!cancelArgs.Cancel)
                            {
                                pipelineStep.Process(this, propertyBag);
                            }
                        }, stepWithTimeout.ProcessorTimeout);
                }
                else
                {
                    pipelineStep.Process(this, propertyBag);
                }

                m_Logger.Debug("Executed pipeline step {0} in {1}", pipelineStep.GetType().Name, sw.Elapsed);
            }
            catch (Exception ex)
            {
                OnProcessorException(propertyBag, ex);
            }
        }
コード例 #4
0
ファイル: Crawler.cs プロジェクト: bormaxi/NCrawler
 private void ExecutePipeLineStep(IPipelineStep pipelineStep, PropertyBag propertyBag)
 {
     try
     {
         if (pipelineStep is IPipelineStepWithTimeout)
         {
             IPipelineStepWithTimeout stepWithTimeout = (IPipelineStepWithTimeout) pipelineStep;
             m_Logger.Debug("Running pipeline step {0} with timeout {1}",
                 pipelineStep.GetType().Name, stepWithTimeout.ProcessorTimeout);
             m_TaskRunner.RunSync(() => pipelineStep.Process(this, propertyBag), stepWithTimeout.ProcessorTimeout);
         }
         else
         {
             m_Logger.Debug("Running pipeline step {0}", pipelineStep.GetType().Name);
             pipelineStep.Process(this, propertyBag);
         }
     }
     catch (Exception ex)
     {
         OnProcessorException(propertyBag, ex);
     }
 }