]> git.ipfire.org Git - thirdparty/bugzilla.git/commitdiff
Bug 1067753: Allow the job queue to specify one or more types of jobs to run
authorMatt Tyson <mtyson@redhat.com>
Mon, 27 Oct 2014 05:48:45 +0000 (13:48 +0800)
committerByron Jones <glob@mozilla.com>
Mon, 27 Oct 2014 05:48:45 +0000 (13:48 +0800)
r=mtyson,a=sgreen

Bugzilla/JobQueue/Runner.pm
jobqueue.pl

index 104a97b0bafbb86dcab03a41d53e59098fb0e7dc..2367f8d77e6b87bb6aa89823545e667f5e093325 100644 (file)
@@ -80,6 +80,7 @@ sub gd_more_opt {
     return (
         'pidfile=s' => \$self->{gd_args}{pidfile},
         'n=s'       => \$self->{gd_args}{progname},
+        'j=s@'      => \$self->{gd_args}{job_name},
     );
 }
 
@@ -210,10 +211,12 @@ sub gd_run {
 sub _do_work {
     my ($self, $fn) = @_;
 
+    my @job_name = @{ $self->{gd_args}{job_name} // [] };
     my $jq = Bugzilla->job_queue();
     $jq->set_verbose($self->{debug});
     $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";
         $jq->can_do($module);
     }
index f6722467c0e3152a4d8b30da1ca9d4871796a2ac..85818033475eb5c69e74d592662d0d6ce47e73cd 100755 (executable)
@@ -33,13 +33,14 @@ jobqueue.pl - Runs jobs in the background for Bugzilla.
  ./jobqueue.pl [OPTIONS] COMMAND
 
    OPTIONS:
-   -f        Run in the foreground (don't detach)
-   -d        Output a lot of debugging information
-   -p file   Specify the file where jobqueue.pl should store its current
-             process id. Defaults to F<data/jobqueue.pl.pid>.
-   -n name   What should this process call itself in the system log?
-             Defaults to the full path you used to invoke the script.
-
+   -f            Run in the foreground (don't detach)
+   -d            Output a lot of debugging information
+   -p file       Specify the file where jobqueue.pl should store its current
+                 process id. Defaults to F<data/jobqueue.pl.pid>.
+   -n name       What should this process call itself in the system log?
+                 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:
    start     Starts a new jobqueue daemon if there isn't one running already
    stop      Stops a running jobqueue daemon