summaryrefslogtreecommitdiffstats
path: root/Bugzilla/JobQueue.pm
diff options
context:
space:
mode:
authorDylan William Hardison <dylan@hardison.net>2018-03-08 21:40:10 +0100
committerGitHub <noreply@github.com>2018-03-08 21:40:10 +0100
commit2056caa180f907c6e5727954547dfd928cf6a360 (patch)
treeca93c1ebd9364ebb99927223ce9101313ba69c9a /Bugzilla/JobQueue.pm
parentedf9851a7ddcab83c6dd54f2294041613ace24f7 (diff)
downloadbugzilla-2056caa180f907c6e5727954547dfd928cf6a360.tar.gz
bugzilla-2056caa180f907c6e5727954547dfd928cf6a360.tar.xz
Revert "Bug 832893: change jobqueue.pl to spawn worker processes to deliver bugmail to avoid memory leaks"
Diffstat (limited to 'Bugzilla/JobQueue.pm')
-rw-r--r--Bugzilla/JobQueue.pm53
1 files changed, 0 insertions, 53 deletions
diff --git a/Bugzilla/JobQueue.pm b/Bugzilla/JobQueue.pm
index b3b54de79..55d40bfb8 100644
--- a/Bugzilla/JobQueue.pm
+++ b/Bugzilla/JobQueue.pm
@@ -14,9 +14,7 @@ use warnings;
use Bugzilla::Constants;
use Bugzilla::Error;
use Bugzilla::Install::Util qw(install_string);
-use File::Slurp;
use base qw(TheSchwartz);
-use fields qw(_worker_pidfile);
# This maps job names for Bugzilla::JobQueue to the appropriate modules.
# If you add new types of jobs, you should add a mapping here.
@@ -93,57 +91,6 @@ sub insert {
return $retval;
}
-# To avoid memory leaks/fragmentation which tends to happen for long running
-# perl processes; check for jobs, and spawn a new process to empty the queue.
-sub subprocess_worker {
- my $self = shift;
-
- my $command = "$0 -p '" . $self->{_worker_pidfile} . "' onepass";
-
- while (1) {
- my $time = (time);
- my @jobs = $self->list_jobs({
- funcname => $self->{all_abilities},
- run_after => $time,
- grabbed_until => $time,
- limit => 1,
- });
- if (@jobs) {
- $self->debug("Spawning queue worker process");
- # Run the worker as a daemon
- system $command;
- # And poll the PID to detect when the working has finished.
- # We do this instead of system() to allow for the INT signal to
- # interrup us and trigger kill_worker().
- my $pid = read_file($self->{_worker_pidfile}, err_mode => 'quiet');
- if ($pid) {
- sleep(3) while(kill(0, $pid));
- }
- $self->debug("Queue worker process completed");
- } else {
- $self->debug("No jobs found");
- }
- sleep(5);
- }
-}
-
-sub kill_worker {
- my $self = Bugzilla->job_queue();
- if ($self->{_worker_pidfile} && -e $self->{_worker_pidfile}) {
- my $worker_pid = read_file($self->{_worker_pidfile});
- if ($worker_pid && kill(0, $worker_pid)) {
- $self->debug("Stopping worker process");
- system "$0 -f -p '" . $self->{_worker_pidfile} . "' stop";
- }
- }
-}
-
-sub set_pidfile {
- my ($self, $pidfile) = @_;
- $pidfile =~ s/^(.+)(\..+)$/$1.worker$2/;
- $self->{_worker_pidfile} = $pidfile;
-}
-
# Clear the request cache at the start of each run.
sub work_once {
my $self = shift;