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