Bug 1067753: Allow the job queue to specify one or more types of jobs to run

r=mtyson,a=sgreen


git-svn-id: svn://10.0.0.236/trunk@265639 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
bzrmirror%bugzilla.org 2014-10-27 06:00:47 +00:00
parent 1866498e6a
commit 1fb624196d
4 changed files with 14 additions and 10 deletions

View File

@ -1 +1 @@
9184 9185

View File

@ -1 +1 @@
5a1a4b92a3381d8bcc7e42808961420c27dd0c38 0a3062afeb7d129553f626408da7e00bfda25cc2

View File

@ -80,6 +80,7 @@ sub gd_more_opt {
return ( return (
'pidfile=s' => \$self->{gd_args}{pidfile}, 'pidfile=s' => \$self->{gd_args}{pidfile},
'n=s' => \$self->{gd_args}{progname}, 'n=s' => \$self->{gd_args}{progname},
'j=s@' => \$self->{gd_args}{job_name},
); );
} }
@ -210,10 +211,12 @@ sub gd_run {
sub _do_work { sub _do_work {
my ($self, $fn) = @_; my ($self, $fn) = @_;
my @job_name = @{ $self->{gd_args}{job_name} // [] };
my $jq = Bugzilla->job_queue(); my $jq = Bugzilla->job_queue();
$jq->set_verbose($self->{debug}); $jq->set_verbose($self->{debug});
$jq->set_pidfile($self->{gd_pidfile}); $jq->set_pidfile($self->{gd_pidfile});
foreach my $module (values %{ Bugzilla::JobQueue->job_map() }) { while (my ($key, $module) = each %{ Bugzilla::JobQueue->job_map() }) {
next if @job_name and ! grep { $_ eq $key } @job_name;
eval "use $module"; eval "use $module";
$jq->can_do($module); $jq->can_do($module);
} }

View File

@ -39,7 +39,8 @@ jobqueue.pl - Runs jobs in the background for Bugzilla.
process id. Defaults to F<data/jobqueue.pl.pid>. process id. Defaults to F<data/jobqueue.pl.pid>.
-n name What should this process call itself in the system log? -n name What should this process call itself in the system log?
Defaults to the full path you used to invoke the script. Defaults to the full path you used to invoke the script.
-j job-name The name of jobs to process. Can be specified multiple times.
If not specified, all job types will be processed.
COMMANDS: COMMANDS:
start Starts a new jobqueue daemon if there isn't one running already start Starts a new jobqueue daemon if there isn't one running already
stop Stops a running jobqueue daemon stop Stops a running jobqueue daemon