Commit 4736116e authored by Ivan Vilata-i-Balaguer's avatar Ivan Vilata-i-Balaguer
Browse files

Wait to ping injectors in a single step.

This also avoids accidentally waiting more than expected when the time passed
since last ping is larger than the time remaining until the expected next ping.
parent 55c85306
......@@ -246,8 +246,8 @@ private:
auto injs = _injector_swarm->peers();
_DEBUG("Waiting to ping injectors...");
while (_last_ping_time && (Clock::now() - *_last_ping_time) < _ping_frequency) {
auto d = Clock::now() - *_last_ping_time;
if (_last_ping_time && (Clock::now() - *_last_ping_time) < _ping_frequency) {
auto d = (*_last_ping_time + _ping_frequency) - Clock::now();
async_sleep(get_executor(), d, cancel, yield);
if (cancel) return;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment