Notify the queue runner when a build is deleted
This commit is contained in:
parent
95c4294560
commit
89fb723ace
|
@ -206,6 +206,7 @@ void State::queueMonitorLoop()
|
|||
receiver buildsAdded(*conn, "builds_added");
|
||||
receiver buildsRestarted(*conn, "builds_restarted");
|
||||
receiver buildsCancelled(*conn, "builds_cancelled");
|
||||
receiver buildsDeleted(*conn, "builds_deleted");
|
||||
|
||||
auto store = openStore(); // FIXME: pool
|
||||
|
||||
|
@ -225,7 +226,7 @@ void State::queueMonitorLoop()
|
|||
printMsg(lvlTalkative, "got notification: builds restarted");
|
||||
lastBuildId = 0; // check all builds
|
||||
}
|
||||
if (buildsCancelled.get()) {
|
||||
if (buildsCancelled.get() || buildsDeleted.get()) {
|
||||
printMsg(lvlTalkative, "got notification: builds cancelled");
|
||||
removeCancelledBuilds(*conn);
|
||||
}
|
||||
|
|
|
@ -202,6 +202,22 @@ create table Builds (
|
|||
);
|
||||
|
||||
|
||||
#ifdef POSTGRESQL
|
||||
|
||||
create function notifyBuildDeleted() returns trigger as $$
|
||||
begin
|
||||
execute 'notify builds_deleted';
|
||||
return null;
|
||||
end;
|
||||
$$ language plpgsql;
|
||||
|
||||
create trigger BuildDeleted after delete on Builds
|
||||
for each row
|
||||
execute procedure notifyBuildDeleted();
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
create table BuildOutputs (
|
||||
build integer not null,
|
||||
name text not null,
|
||||
|
|
10
src/sql/upgrade-35.sql
Normal file
10
src/sql/upgrade-35.sql
Normal file
|
@ -0,0 +1,10 @@
|
|||
create function notifyBuildDeleted() returns trigger as $$
|
||||
begin
|
||||
execute 'notify builds_deleted';
|
||||
return null;
|
||||
end;
|
||||
$$ language plpgsql;
|
||||
|
||||
create trigger BuildDeleted after delete on Builds
|
||||
for each row
|
||||
execute procedure notifyBuildDeleted();
|
Loading…
Reference in a new issue