martinzink commented on code in PR #1581:
URL: https://github.com/apache/nifi-minifi-cpp/pull/1581#discussion_r1221354436


##########
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:
   good point, I've changed the behaviour in 
https://github.com/apache/nifi-minifi-cpp/pull/1581/commits/adac20e8318a942ba0220a3a4b71b889aa6675ae,
 and created a helper function that does this calculation (its based on the 
time_point so I think thats expectable)



-- 
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]

Reply via email to