szaszm commented on code in PR #1581:
URL: https://github.com/apache/nifi-minifi-cpp/pull/1581#discussion_r1215630971
##########
libminifi/src/TimerDrivenSchedulingAgent.cpp:
##########
@@ -28,11 +28,13 @@ namespace org::apache::nifi::minifi {
utils::TaskRescheduleInfo TimerDrivenSchedulingAgent::run(core::Processor*
processor, const std::shared_ptr<core::ProcessContext> &processContext,
const
std::shared_ptr<core::ProcessSessionFactory> &sessionFactory) {
if (this->running_ && processor->isRunning()) {
+ auto trigger_start_time = std::chrono::steady_clock::now();
this->onTrigger(processor, processContext, sessionFactory);
if (processor->isYield())
return utils::TaskRescheduleInfo::RetryIn(processor->getYieldTime());
- return
utils::TaskRescheduleInfo::RetryIn(std::chrono::duration_cast<std::chrono::milliseconds>(processor->getSchedulingPeriodNano()));
+ auto next_execution_time_point = trigger_start_time +
processor->getSchedulingPeriod();
+ return utils::TaskRescheduleInfo::RetryIn(next_execution_time_point -
std::chrono::steady_clock::now());
Review Comment:
I think this is surprising behavior, and it would be better to have a narrow
contract precondition in the constructor, and calculate it where it's called.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]