summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBent Bisballe Nyeng <deva@aasimon.org>2022-06-16 20:00:53 +0200
committerBent Bisballe Nyeng <deva@aasimon.org>2022-06-16 20:00:53 +0200
commit5ed9b42bad3d1fed22f371da6672ffaf044c57aa (patch)
tree65abd5a5024b2e4975f4925fe9c13a3b7156f34e
parentb1b290b0e3cad1b362ec56a7aeb8db05e63007da (diff)
Tweak sleeps in builder loop.
-rw-r--r--src/build.cc12
1 files 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);
}
}