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:
		@@ -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;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user