From 27a32e4bfb4a76b7f3f3b00d381496ee0d211771 Mon Sep 17 00:00:00 2001 From: Marius Gavrilescu Date: Wed, 4 Feb 2015 22:40:26 +0200 Subject: [PATCH] Skip private jobs in update_status faster --- lib/Gruntmaster/Data.pm | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) 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; -- 2.39.2