Skip to content
Snippets Groups Projects
Commit 4aad11f0 authored by Simon Désaulniers's avatar Simon Désaulniers Committed by Adrien Béraud
Browse files

dht: fix Scheduler::run() job calls order

When executing a job, the internal jobs map can be changed, therefor successive
job calls have to make another call to timers.begin() to get the first job to
execute.
parent dc1e1d94
Branches
Tags
No related merge requests found
......@@ -83,8 +83,9 @@ public:
*/
time_point run() {
syncTime();
for (auto t = timers.begin(); t != timers.end(); ) {
if (t->first > now)
while (not timers.empty()) {
auto timer = timers.begin();
if (timer->first > now)
break;
auto& job = timer->second;
......@@ -92,7 +93,7 @@ public:
job->do_();
job->done = true;
}
t = timers.erase(t);
timers.erase(timer);
}
return getNextJobTime();
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment