From: Don Armstrong Date: Tue, 10 Apr 2018 23:14:00 +0000 (-0700) Subject: zero out blocks/mergedwith even if there are no blocks/mergedwith X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=05c56cc7427270f6f08bc96c2fa4b10ff3459bc4;p=debbugs.git zero out blocks/mergedwith even if there are no blocks/mergedwith --- diff --git a/Debbugs/DB/Load.pm b/Debbugs/DB/Load.pm index d08c518..4018791 100644 --- a/Debbugs/DB/Load.pm +++ b/Debbugs/DB/Load.pm @@ -254,19 +254,21 @@ sub load_bug { # yet, we can't handle them until we've loaded all bugs. queue # them up. for my $merge_block (qw(mergedwith blocks)) { - if (@{$data->{$merge_block}||[]}) { - my $count = $s->resultset('Bug')-> + my $count = 0; + if (@{$data->{$merge_block}}) { + $count = + $s->resultset('Bug')-> search({id => [@{$data->{$merge_block}}]})-> count(); - # if all of the bugs exist, immediately fix the merge/blocks - if ($count == @{$data->{$merge_block}}) { - handle_load_bug_queue(db=>$s, - queue => {$merge_block, - {$data->{bug_num},[@{$data->{$merge_block}}]} - }); - } else { - $queue->{$merge_block}{$data->{bug_num}} = [@{$data->{$merge_block}}]; - } + } + # if all of the bugs exist, immediately fix the merge/blocks + if ($count == @{$data->{$merge_block}}) { + handle_load_bug_queue(db=>$s, + queue => {$merge_block, + {$data->{bug_num},[@{$data->{$merge_block}}]} + }); + } else { + $queue->{$merge_block}{$data->{bug_num}} = [@{$data->{$merge_block}}]; } } @@ -310,6 +312,7 @@ sub handle_load_bug_queue{ for my $queue_type (keys %queue_types) { my $qt = $queue_types{$queue_type}; my @bugs = keys %{$queue->{$queue_type}}; + next unless @bugs; my @entries; for my $bug (@bugs) { push @entries,