forked from lix-project/hydra
hydra-notify: Fix processing notifications
This commit is contained in:
parent
7c7cc8c059
commit
72c36373bb
|
@ -96,27 +96,28 @@ my $sel = IO::Select->new($fd);
|
||||||
|
|
||||||
while (1) {
|
while (1) {
|
||||||
$sel->can_read;
|
$sel->can_read;
|
||||||
my $notify = $dbh->func("pg_notifies");
|
|
||||||
next if !$notify;
|
|
||||||
|
|
||||||
my ($channelName, $pid, $payload) = @$notify;
|
while (my $notify = $dbh->func("pg_notifies")) {
|
||||||
#print STDERR "got '$channelName' from $pid: $payload\n";
|
|
||||||
|
|
||||||
my @payload = split /\t/, $payload;
|
my ($channelName, $pid, $payload) = @$notify;
|
||||||
|
#print STDERR "got '$channelName' from $pid: $payload\n";
|
||||||
|
|
||||||
eval {
|
my @payload = split /\t/, $payload;
|
||||||
if ($channelName eq "build_started") {
|
|
||||||
buildStarted(int($payload[0]));
|
eval {
|
||||||
} elsif ($channelName eq "build_finished") {
|
if ($channelName eq "build_started") {
|
||||||
my $buildId = int($payload[0]);
|
buildStarted(int($payload[0]));
|
||||||
my $build = $db->resultset('Builds')->find($buildId)
|
} elsif ($channelName eq "build_finished") {
|
||||||
or die "build $buildId does not exist\n";
|
my $buildId = int($payload[0]);
|
||||||
buildFinished($build, @payload[1..$#payload]);
|
my $build = $db->resultset('Builds')->find($buildId)
|
||||||
} elsif ($channelName eq "step_finished") {
|
or die "build $buildId does not exist\n";
|
||||||
stepFinished(int($payload[0]), int($payload[1]));
|
buildFinished($build, @payload[1..$#payload]);
|
||||||
|
} elsif ($channelName eq "step_finished") {
|
||||||
|
stepFinished(int($payload[0]), int($payload[1]));
|
||||||
|
}
|
||||||
|
};
|
||||||
|
if ($@) {
|
||||||
|
print STDERR "error processing message '$payload' on channel '$channelName': $@\n";
|
||||||
}
|
}
|
||||||
};
|
|
||||||
if ($@) {
|
|
||||||
print STDERR "error processing message '$payload' on channel '$channelName': $@\n";
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue