Skip to content

Commit 44de71a

Browse files
committed
progress-bar: re-draw last update if nothing new for 1sec.
Slightly nicer behavior when updates are somewhat far apart (during a long linking step, perhaps) ensuring things don't appear unresponsive. If we wait the maximum amount for the update, don't bother waiting another 50ms (for rate-limiting purposes) and just check if we should quit. This also ensures we'll notice the request to quit within 1s if quit is signalled but there is not an udpate. (I'm not sure if this happens or not)
1 parent f601bc0 commit 44de71a

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

src/nix/progress-bar.cc

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,9 +75,10 @@ class ProgressBar : public Logger
7575
updateThread = std::thread([&]() {
7676
auto state(state_.lock());
7777
while (state->active) {
78-
state.wait(updateCV);
78+
auto r = state.wait_for(updateCV, std::chrono::seconds(1));
7979
draw(*state);
80-
state.wait_for(quitCV, std::chrono::milliseconds(50));
80+
if (r == std::cv_status::no_timeout)
81+
state.wait_for(quitCV, std::chrono::milliseconds(50));
8182
}
8283
});
8384
}

0 commit comments

Comments
 (0)