summaryrefslogtreecommitdiffstats
path: root/Bugzilla/JobQueue
diff options
context:
space:
mode:
authorByron Jones <bjones@mozilla.com>2013-02-07 08:56:05 +0100
committerByron Jones <bjones@mozilla.com>2013-02-07 08:56:05 +0100
commit6df7b9816541893a905eec56c333b40673522e84 (patch)
treea09bc62b33039fccef6a2c5cf6d0cacb9d8b9b92 /Bugzilla/JobQueue
parent4d295ae996aa2b46dee2b66a3ba1270345cacd3d (diff)
downloadbugzilla-6df7b9816541893a905eec56c333b40673522e84.tar.gz
bugzilla-6df7b9816541893a905eec56c333b40673522e84.tar.xz
Bug 832893: change jobqueue.pl to spawn worker processes to deliver bugmail to avoid memory leaks
Diffstat (limited to 'Bugzilla/JobQueue')
-rw-r--r--Bugzilla/JobQueue/Runner.pm25
1 files changed, 16 insertions, 9 deletions
diff --git a/Bugzilla/JobQueue/Runner.pm b/Bugzilla/JobQueue/Runner.pm
index 26755e78f..d45c36647 100644
--- a/Bugzilla/JobQueue/Runner.pm
+++ b/Bugzilla/JobQueue/Runner.pm
@@ -51,6 +51,7 @@ our $initscript = "bugzilla-queue";
sub gd_preconfig {
my $self = shift;
+ $self->{_run_command} = 'subprocess_worker';
my $pidfile = $self->{gd_args}{pidfile};
if (!$pidfile) {
$pidfile = bz_locations()->{datadir} . '/' . $self->{gd_progname}
@@ -196,21 +197,26 @@ sub gd_setup_signals {
$SIG{TERM} = sub { $self->gd_quit_event(); }
}
-sub gd_other_cmd {
- my ($self) = shift;
- if ($ARGV[0] eq "once") {
- $self->_do_work("work_once");
+sub gd_quit_event {
+ Bugzilla->job_queue->kill_worker();
+ exit(1);
+}
- exit(0);
+sub gd_other_cmd {
+ my ($self, $do, $locked) = @_;
+ if ($do eq "once") {
+ $self->{_run_command} = 'work_once';
+ } elsif ($do eq "onepass") {
+ $self->{_run_command} = 'work_until_done';
+ } else {
+ $self->SUPER::gd_other_cmd($do, $locked);
}
-
- $self->SUPER::gd_other_cmd();
}
sub gd_run {
my $self = shift;
-
- $self->_do_work("work");
+ $SIG{__DIE__} = \&Carp::confess if $self->{debug};
+ $self->_do_work($self->{_run_command});
}
sub _do_work {
@@ -218,6 +224,7 @@ sub _do_work {
my $jq = Bugzilla->job_queue();
$jq->set_verbose($self->{debug});
+ $jq->set_pidfile($self->{gd_pidfile});
foreach my $module (values %{ Bugzilla::JobQueue->job_map() }) {
eval "use $module";
$jq->can_do($module);