File tree Expand file tree Collapse file tree 1 file changed +9
-2
lines changed
Expand file tree Collapse file tree 1 file changed +9
-2
lines changed Original file line number Diff line number Diff line change @@ -251,13 +251,20 @@ void TreeExecutionServer::execute(
251251 goal_handle->publish_feedback (feedback);
252252 }
253253
254- const auto now = std::chrono::steady_clock::now ();
254+ auto now = std::chrono::steady_clock::now ();
255255 if (now < loop_deadline)
256256 {
257257 p_->tree .sleep (std::chrono::duration_cast<std::chrono::system_clock::duration>(
258258 loop_deadline - now));
259+ now = std::chrono::steady_clock::now ();
260+ }
261+ // If sleep was woken early, it will still be before the next deadline
262+ // so it might still be necessary to wait for it. Only advance to the
263+ // next deadline if one has passed.
264+ if (now >= loop_deadline)
265+ {
266+ loop_deadline += period;
259267 }
260- loop_deadline += period;
261268 }
262269 }
263270 catch (const std::exception& ex)
You can’t perform that action at this time.
0 commit comments