summaryrefslogtreecommitdiffstats
path: root/extensions/Push/lib/Push.pm
diff options
context:
space:
mode:
Diffstat (limited to 'extensions/Push/lib/Push.pm')
-rw-r--r--extensions/Push/lib/Push.pm19
1 files changed, 17 insertions, 2 deletions
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;