| 30 | namespace minifi { |
| 31 | |
| 32 | utils::TaskRescheduleInfo TimerDrivenSchedulingAgent::run(const std::shared_ptr<core::Processor> &processor, const std::shared_ptr<core::ProcessContext> &processContext, |
| 33 | const std::shared_ptr<core::ProcessSessionFactory> &sessionFactory) { |
| 34 | if (this->running_ && processor->isRunning()) { |
| 35 | bool shouldYield = this->onTrigger(processor, processContext, sessionFactory); |
| 36 | if (processor->isYield()) { |
| 37 | // Honor the yield |
| 38 | return utils::TaskRescheduleInfo::RetryIn(std::chrono::milliseconds(processor->getYieldTime())); |
| 39 | } else if (shouldYield && this->bored_yield_duration_ > 0) { |
| 40 | // No work to do or need to apply back pressure |
| 41 | return utils::TaskRescheduleInfo::RetryIn(std::chrono::milliseconds(this->bored_yield_duration_)); |
| 42 | } |
| 43 | return utils::TaskRescheduleInfo::RetryIn(std::chrono::duration_cast<std::chrono::milliseconds>( |
| 44 | std::chrono::nanoseconds(processor->getSchedulingPeriodNano()))); |
| 45 | } |
| 46 | return utils::TaskRescheduleInfo::Done(); |
| 47 | } |
| 48 | |
| 49 | } /* namespace minifi */ |
| 50 | } /* namespace nifi */ |
nothing calls this directly
no test coverage detected