Cleanup worker json handling.

This commit is contained in:
John Soo 2022-04-21 11:25:40 -07:00
parent 7aa9835adb
commit f98da2e00b
No known key found for this signature in database
GPG key ID: D8A148F8CE4DDBC2

View file

@ -252,9 +252,7 @@ static void worker(
debug("worker process %d at '%s'", getpid(), attrPath);
/* Evaluate it and send info back to the collector. */
nlohmann::json reply;
reply["attr"] = attrPath;
nlohmann::json reply = nlohmann::json{ { "attr", attrPath } };
try {
auto vTmp = findAlongAttrPath(state, attrPath, autoArgs, *vRoot).first;
@ -264,9 +262,7 @@ static void worker(
if (auto drvInfo = getDerivation(state, *v, false)) {
auto drv = Drv(state, *drvInfo);
reply = drv;
reply["attr"] = attrPath;
reply.update(drv);
/* Register the derivation as a GC root. !!! This
registers roots for jobs that we may have already