Queue-runner: Always produce a machines JSON object

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
parent 1c52c4c0ed
commit a5b17d0686

View File

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