From 5ed9b42bad3d1fed22f371da6672ffaf044c57aa Mon Sep 17 00:00:00 2001 From: Bent Bisballe Nyeng Date: Thu, 16 Jun 2022 20:00:53 +0200 Subject: Tweak sleeps in builder loop. --- src/build.cc | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/src/build.cc b/src/build.cc index 081c156..98952e0 100644 --- a/src/build.cc +++ b/src/build.cc @@ -84,7 +84,9 @@ int build(const Settings& settings, return task->run(); })); started_one = true; - std::this_thread::sleep_for(2ms); + // Make sure we don't start tasks on top of each other to prevent + // straining the disk. + std::this_thread::sleep_for(50ms); } for(auto process = processes.begin(); @@ -106,13 +108,9 @@ int build(const Settings& settings, break; } - if(started_one) + if(!started_one) // prevent polling too fast if no task is yet ready { - std::this_thread::sleep_for(2ms); - } - else - { - std::this_thread::sleep_for(200ms); + std::this_thread::sleep_for(10ms); } } -- cgit v1.2.3