Rather than one child per job, which then did one report per branch.

This will mean we can use the cache machinery, which is rather global
so wouldn't cope well with processing multiple job history reports
within a process.

Signed-off-by: Ian Jackson <ian.jack...@eu.citrix.com>
---
 sg-report-job-history | 15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)

diff --git a/sg-report-job-history b/sg-report-job-history
index 384a7670..3307b281 100755
--- a/sg-report-job-history
+++ b/sg-report-job-history
@@ -296,15 +296,16 @@ END
     }
 }
 
-sub processjob ($) {
-    my ($j) = @_;
-    processjobbranch($j,undef);
-    processjobbranch($j,$_) foreach @branches;
+my @tasks;
+foreach my $j (@jobs) {
+    push @tasks, $j;
+    push @tasks, "$j $_" foreach @branches;
 }
 
-parallel_by_fork('sg-report-job-history', $maxjobs, \@jobs, sub {
-    my ($j) = @_;
+parallel_by_fork('sg-report-job-history', $maxjobs, \@tasks, sub {
+    my ($task) = @_;
+    my ($job, $branch) = split / /, $task; # $branch might be undef
     db_retry($dbh_tests, [], sub {
-        processjob($j);
+        processjobbranch($job, $branch);
     });
 });
-- 
2.11.0


Reply via email to