summaryrefslogtreecommitdiffstats
path: root/Bugzilla/JobQueue
diff options
context:
space:
mode:
authorByron Jones <bjones@mozilla.com>2013-02-15 06:57:04 +0100
committerByron Jones <bjones@mozilla.com>2013-02-15 06:57:04 +0100
commitb6dedf486972c23b05f16a00c2be1c32e139eb1f (patch)
tree7451ee504401e8d075d32a76d9d6ad28adfe71bc /Bugzilla/JobQueue
parent9986a6db7d542365f03f45246553060dcfcff388 (diff)
downloadbugzilla-b6dedf486972c23b05f16a00c2be1c32e139eb1f.tar.gz
bugzilla-b6dedf486972c23b05f16a00c2be1c32e139eb1f.tar.xz
Bug 832893: changes jobqueue.pl to spawn worker processes to deliver bugmail to avoid memory leaks
r=dkl, a=LpSolit
Diffstat (limited to 'Bugzilla/JobQueue')
-rw-r--r--Bugzilla/JobQueue/Runner.pm28
1 files changed, 18 insertions, 10 deletions
diff --git a/Bugzilla/JobQueue/Runner.pm b/Bugzilla/JobQueue/Runner.pm
index 7ab4f7f1a..a0d6a77cb 100644
--- a/Bugzilla/JobQueue/Runner.pm
+++ b/Bugzilla/JobQueue/Runner.pm
@@ -38,6 +38,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}
@@ -136,6 +137,7 @@ sub gd_can_install {
print $config_fh <<END;
#!/bin/sh
BUGZILLA="$directory"
+# This user must have write access to Bugzilla's data/ directory.
USER=$owner
END
close($config_fh);
@@ -183,21 +185,25 @@ 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");
+ $self->_do_work($self->{_run_command});
}
sub _do_work {
@@ -205,11 +211,11 @@ 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);
}
-
$jq->$fn;
}
@@ -242,6 +248,8 @@ to run the Bugzilla job queue.
=item gd_can_install
+=item gd_quit_event
+
=item gd_other_cmd
=item gd_more_opt