Queue-runner: Always produce a machines JSON object
Some checks failed
Test / tests (pull_request) Has been cancelled

Even if there are no machines, there should at least be an empty object.
This commit is contained in:
John Ericson 2025-04-08 17:38:19 -04:00 committed by ahuston-0
parent 65618fd590
commit 33a935e8ef

View File

@ -615,6 +615,7 @@ void State::dumpStatus(Connection & conn)
} }
{ {
auto machines_json = json::object();
auto machines_(machines.lock()); auto machines_(machines.lock());
for (auto & i : *machines_) { for (auto & i : *machines_) {
auto & m(i.second); auto & m(i.second);
@ -641,8 +642,9 @@ void State::dumpStatus(Connection & conn)
machine["avgStepTime"] = (float) s->totalStepTime / s->nrStepsDone; machine["avgStepTime"] = (float) s->totalStepTime / s->nrStepsDone;
machine["avgStepBuildTime"] = (float) s->totalStepBuildTime / s->nrStepsDone; machine["avgStepBuildTime"] = (float) s->totalStepBuildTime / s->nrStepsDone;
} }
statusJson["machines"][m->storeUri.render()] = machine; machines_json[m->storeUri.render()] = machine;
} }
statusJson["machines"] = machines_json;
} }
{ {