예제 #1
0
        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
        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);
     }
 }