Set notificationpendingsince for dependent builds

`build_finished` Postgres event will never be fired for the dependent builds.

For example, on our Hydra, the following query always returns increasing
numbers, even though all notifications have been delivered:

```
hydra=> select count(1) from builds where notificationpendingsince is not null;
 count
-------
  4583
(1 row)
```

Thus, we have to iterate over all dependent builds and mark their
`notificationpendingsince` as `null`, otherwise they will pile up until
the next restart of hydra-notify, when they will get delivered.
This commit is contained in:
Nikola Knezevic 2020-05-28 10:45:41 +02:00
parent a1e08d8819
commit 7d52946982

View file

@ -63,7 +63,13 @@ sub buildFinished {
} }
} }
$build->update({ notificationpendingsince => undef }); # We have to iterate through all dependents as well, and if they are finished
# to mark their notificationpendingsince.
# Otherwise, the dependent builds will remain with notificationpendingsince set
# until hydra-notify is started, as buildFinished is never emitted for them.
foreach my $b ($build, @dependents) {
$b->update({ notificationpendingsince => undef }) if $b->finished;
}
} }
sub stepFinished { sub stepFinished {