Use PostgreSQL notifications for queue events

Hydra-queue-runner now no longer polls the queue periodically, but
instead sleeps until it receives a notification from PostgreSQL about
a change to the queue (build added, build cancelled or build
restarted).

Also, for the "build added" case, we now only check for builds with an
ID greater than the previous greatest ID. This is much more efficient
if the queue is large.
This commit is contained in:
Eelco Dolstra
2015-06-11 17:38:55 +02:00
parent d72a88b562
commit c08883966c
4 changed files with 48 additions and 14 deletions

View File

@ -469,6 +469,8 @@ sub restartBuilds($$) {
# FIXME: Add this to the API.
# FIXME: clear the dependencies?
$db->resultset('FailedPaths')->search({ path => [ @paths ]})->delete;
$db->storage->dbh->do("notify builds_restarted");
});
return scalar(@buildIds);