Turn hydra-notify into a daemon

It now receives notifications about started/finished builds/steps via
PostgreSQL. This gets rid of the (substantial) overhead of starting
hydra-notify for every event. It also allows other programs (even on
other machines) to listen to Hydra notifications.
This commit is contained in:
Eelco Dolstra
2019-08-09 19:11:38 +02:00
parent f13a2cb6dc
commit 2946899504
5 changed files with 105 additions and 174 deletions

View File

@ -193,13 +193,12 @@ bool State::getQueuedBuilds(Connection & conn,
(build->id)
((int) (ex.step->drvPath == build->drvPath ? bsFailed : bsDepFailed))
(time(0)).exec();
notifyBuildFinished(txn, build->id, {});
txn.commit();
build->finishedInDB = true;
nrBuildsDone++;
}
enqueueNotificationItem({NotificationItem::Type::BuildFinished, build->id});
return;
}
@ -230,13 +229,12 @@ bool State::getQueuedBuilds(Connection & conn,
time_t now = time(0);
printMsg(lvlInfo, format("marking build %1% as succeeded (cached)") % build->id);
markSucceededBuild(txn, build, res, true, now, now);
notifyBuildFinished(txn, build->id, {});
txn.commit();
}
build->finishedInDB = true;
enqueueNotificationItem({NotificationItem::Type::BuildFinished, build->id});
return;
}