summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--extensions/Push/lib/Config.pm2
-rw-r--r--extensions/Push/lib/Push.pm19
2 files changed, 18 insertions, 3 deletions
diff --git a/extensions/Push/lib/Config.pm b/extensions/Push/lib/Config.pm
index 31fa6af36..7033b4195 100644
--- a/extensions/Push/lib/Config.pm
+++ b/extensions/Push/lib/Config.pm
@@ -80,7 +80,7 @@ sub load {
# done, update self
foreach my $name (keys %$config) {
my $value = $self->option($name)->{type} eq 'password' ? '********' : $config->{$name};
- $logger->debug(sprintf("%s: set %s=%s\n", $self->{_name}, $name, $value));
+ $logger->debug(sprintf("%s: set %s=%s\n", $self->{_name}, $name, $value || ''));
$self->{$name} = $config->{$name};
}
}
diff --git a/extensions/Push/lib/Push.pm b/extensions/Push/lib/Push.pm
index 76b82dda4..aaac0bbd6 100644
--- a/extensions/Push/lib/Push.pm
+++ b/extensions/Push/lib/Push.pm
@@ -49,8 +49,10 @@ sub start {
}
while(1) {
- $self->_reload();
- $self->push();
+ if ($self->_dbh_check()) {
+ $self->_reload();
+ $self->push();
+ }
sleep(POLL_INTERVAL_SECONDS);
}
}
@@ -246,4 +248,17 @@ sub log {
return $self->{log};
}
+sub _dbh_check {
+ my ($self) = @_;
+ eval {
+ Bugzilla->dbh->selectrow_array("SELECT 1 FROM push");
+ };
+ if ($@) {
+ $self->logger->error(clean_error($@));
+ return 0;
+ } else {
+ return 1;
+ }
+}
+
1;