aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDan Fandrich <danf@mageia.org>2024-03-21 21:00:12 -0700
committerDan Fandrich <danf@mageia.org>2024-03-21 21:00:12 -0700
commit82bfec6e44209b4e1bce115e4adca62d0fffb279 (patch)
treebb840e9be8ae0b2530a7074235c5d4d9bcb26757
parentb9846fe26e87285ceab8ae5cd9c212325bd15f51 (diff)
downloadmgaadvisories-master.tar
mgaadvisories-master.tar.gz
mgaadvisories-master.tar.bz2
mgaadvisories-master.tar.xz
mgaadvisories-master.zip
Exit if any of the parallel processes return an errorHEADmaster
-rw-r--r--lib/MGA/Advisories.pm11
1 files changed, 10 insertions, 1 deletions
diff --git a/lib/MGA/Advisories.pm b/lib/MGA/Advisories.pm
index dbb7408..4663eb6 100644
--- a/lib/MGA/Advisories.pm
+++ b/lib/MGA/Advisories.pm
@@ -621,6 +621,14 @@ sub process_template {
# Max 10 processes for processing templates
my $pm = Parallel::ForkManager->new(10);
+$pm->run_on_finish(\&parallel_finish);
+my $parallelerror = 0;
+
+# Store error flag from forked process
+sub parallel_finish {
+ my ($pid, $exit_code, $ident) = @_;
+ $parallelerror |= $exit_code;
+}
# Run process_template in its own process. The process creation overhead is
# high, so this only makes sense for templates that interate over all or most
@@ -633,9 +641,10 @@ sub parallel_process_template {
}
}
-# Wait for all processes to finish
+# Wait for all processes to finish & die if any returned an error
sub parallel_complete {
$pm->wait_all_children;
+ die "Error writing output" if $parallelerror;
}
sub output_pages {