From: Marius Gavrilescu Date: Wed, 4 Feb 2015 20:40:26 +0000 (+0200) Subject: Skip private jobs in update_status faster X-Git-Tag: 5999.000_014~87 X-Git-Url: http://git.ieval.ro/?a=commitdiff_plain;h=27a32e4bfb4a76b7f3f3b00d381496ee0d211771;p=gruntmaster-data.git Skip private jobs in update_status faster --- diff --git a/lib/Gruntmaster/Data.pm b/lib/Gruntmaster/Data.pm index 447a9f4..ed40c37 100644 --- a/lib/Gruntmaster/Data.pm +++ b/lib/Gruntmaster/Data.pm @@ -176,10 +176,13 @@ sub update_status { my ($self) = @_; my @jobs = $self->jobs->search({'me.private' => 0}, {cache => 1, prefetch => 'problem'})->all; + my %private; my %hash; for (@jobs) { - next if !$_->problem->is_in_archive; - $hash{$_->get_column('problem'), $_->get_column('owner')} = [$_->id, $_->result ? 0 : 1] for @jobs; + my $pb = $_->get_column('problem'); + $private{$pb} //= $_->problem->is_private; + next if !$private{$pb}; + $hash{$pb, $_->get_column('owner')} = [$_->id, $_->result ? 0 : 1] for @jobs; } my @problem_statuses = map { [split ($;), @{$hash{$_}} ] } keys %hash;