Skip to content

Commit

Permalink
Flush lazy pulls more often
Browse files Browse the repository at this point in the history
  • Loading branch information
SergiySW committed Dec 6, 2018
1 parent 03d83ef commit d94a9cf
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions rai/node/bootstrap.cpp
Expand Up @@ -1232,6 +1232,7 @@ void rai::bootstrap_attempt::lazy_run ()
std::unique_lock<std::mutex> lock (mutex);
while ((still_pulling () || !lazy_finished ()) && std::chrono::steady_clock::now () - start_time < max_time)
{
unsigned iterations (0);
while (still_pulling () && std::chrono::steady_clock::now () - start_time < max_time)
{
if (!pulls.empty ())
Expand All @@ -1249,6 +1250,14 @@ void rai::bootstrap_attempt::lazy_run ()
{
condition.wait (lock);
}
++iterations;
// Flushing lazy pulls
if (iterations % 100 == 0)
{
lock.unlock ();
lazy_pull_flush ();
lock.lock ();
}
}
// Flushing may resolve forks which can add more pulls
// Flushing lazy pulls
Expand Down

0 comments on commit d94a9cf

Please sign in to comment.