forked from lix-project/hydra
hydra-queue-runner: Ensure regular status dumps
This commit is contained in:
parent
4151be7e69
commit
4b9c76e502
|
@ -683,7 +683,10 @@ void State::dumpStatus(Connection & conn, bool log)
|
|||
}
|
||||
}
|
||||
|
||||
if (log) printMsg(lvlInfo, format("status: %1%") % out.str());
|
||||
if (log && time(0) >= lastStatusLogged + statusLogInterval) {
|
||||
printMsg(lvlInfo, format("status: %1%") % out.str());
|
||||
lastStatusLogged = time(0);
|
||||
}
|
||||
|
||||
{
|
||||
auto mc = startDbUpdate();
|
||||
|
@ -826,8 +829,8 @@ void State::run(BuildID buildOne)
|
|||
auto conn(dbPool.get());
|
||||
receiver dumpStatus_(*conn, "dump_status");
|
||||
while (true) {
|
||||
bool timeout = conn->await_notification(300, 0) == 0;
|
||||
dumpStatus(*conn, timeout);
|
||||
conn->await_notification(statusLogInterval / 2 + 1, 0);
|
||||
dumpStatus(*conn, true);
|
||||
}
|
||||
} catch (std::exception & e) {
|
||||
printMsg(lvlError, format("main thread: %1%") % e.what());
|
||||
|
|
|
@ -359,6 +359,9 @@ private:
|
|||
|
||||
size_t maxOutputSize = 2ULL << 30;
|
||||
|
||||
time_t lastStatusLogged = 0;
|
||||
const int statusLogInterval = 20;
|
||||
|
||||
public:
|
||||
State();
|
||||
|
||||
|
|
Loading…
Reference in a new issue