Don't spam the journal with hydra-queue-runner status dumps

This commit is contained in:
Eelco Dolstra 2020-03-26 15:30:37 +01:00
parent 45ffe578b6
commit 15ae932488
No known key found for this signature in database
GPG key ID: 8170B4726D7198DE
2 changed files with 5 additions and 13 deletions

View file

@ -491,7 +491,7 @@ std::shared_ptr<PathLocks> State::acquireGlobalLock()
} }
void State::dumpStatus(Connection & conn, bool log) void State::dumpStatus(Connection & conn)
{ {
std::ostringstream out; std::ostringstream out;
@ -672,11 +672,6 @@ void State::dumpStatus(Connection & conn, bool log)
} }
} }
if (log && time(0) >= lastStatusLogged + statusLogInterval) {
printMsg(lvlInfo, format("status: %1%") % out.str());
lastStatusLogged = time(0);
}
{ {
auto mc = startDbUpdate(); auto mc = startDbUpdate();
pqxx::work txn(conn); pqxx::work txn(conn);
@ -785,7 +780,7 @@ void State::run(BuildID buildOne)
{ {
auto conn(dbPool.get()); auto conn(dbPool.get());
clearBusy(*conn, 0); clearBusy(*conn, 0);
dumpStatus(*conn, false); dumpStatus(*conn);
} }
std::thread(&State::monitorMachinesFile, this).detach(); std::thread(&State::monitorMachinesFile, this).detach();
@ -848,8 +843,8 @@ void State::run(BuildID buildOne)
auto conn(dbPool.get()); auto conn(dbPool.get());
receiver dumpStatus_(*conn, "dump_status"); receiver dumpStatus_(*conn, "dump_status");
while (true) { while (true) {
conn->await_notification(statusLogInterval / 2 + 1, 0); conn->await_notification();
dumpStatus(*conn, true); dumpStatus(*conn);
} }
} catch (std::exception & e) { } catch (std::exception & e) {
printMsg(lvlError, format("main thread: %1%") % e.what()); printMsg(lvlError, format("main thread: %1%") % e.what());

View file

@ -420,9 +420,6 @@ private:
size_t maxOutputSize; size_t maxOutputSize;
size_t maxLogSize; size_t maxLogSize;
time_t lastStatusLogged = 0;
const int statusLogInterval = 300;
/* Steps that were busy while we encounted a PostgreSQL /* Steps that were busy while we encounted a PostgreSQL
error. These need to be cleared at a later time to prevent them error. These need to be cleared at a later time to prevent them
from showing up as busy until the queue runner is restarted. */ from showing up as busy until the queue runner is restarted. */
@ -546,7 +543,7 @@ private:
has it. */ has it. */
std::shared_ptr<nix::PathLocks> acquireGlobalLock(); std::shared_ptr<nix::PathLocks> acquireGlobalLock();
void dumpStatus(Connection & conn, bool log); void dumpStatus(Connection & conn);
void addRoot(const nix::StorePath & storePath); void addRoot(const nix::StorePath & storePath);