aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMax Kanat-Alexander <mkanat@bugzilla.org>2010-02-01 15:54:14 -0800
committerMax Kanat-Alexander <mkanat@bugzilla.org>2010-02-01 15:54:14 -0800
commitdec46c31056996458be8eff8bd7cb56b3466e3b3 (patch)
treef0a4f275dca1cbf0ffb0e4ca794b6080ab3aba1e /duplicates.cgi
parentBug 514970: Clean up duplicates.cgi and make it use Bug objects (diff)
downloadbugzilla-dec46c31056996458be8eff8bd7cb56b3466e3b3.tar.gz
bugzilla-dec46c31056996458be8eff8bd7cb56b3466e3b3.tar.bz2
bugzilla-dec46c31056996458be8eff8bd7cb56b3466e3b3.zip
Bug 543459: Speed up the new duplicates.cgi
r=LpSolit, a=LpSolit
Diffstat (limited to 'duplicates.cgi')
-rwxr-xr-xduplicates.cgi11
1 files changed, 6 insertions, 5 deletions
diff --git a/duplicates.cgi b/duplicates.cgi
index cbc991b7d..2a52742c6 100755
--- a/duplicates.cgi
+++ b/duplicates.cgi
@@ -180,16 +180,17 @@ my %since_dups = @{$dbh->selectcol_arrayref(
"SELECT dupe_of, COUNT(dupe)
FROM duplicates INNER JOIN bugs_activity
ON bugs_activity.bug_id = duplicates.dupe
- WHERE added = 'DUPLICATE' AND fieldid = ? AND "
- . $dbh->sql_to_days('bug_when') . " >= ("
- . $dbh->sql_to_days('NOW()') . " - ?)
- GROUP BY dupe_of", {Columns=>[1,2]},
+ WHERE added = 'DUPLICATE' AND fieldid = ?
+ AND bug_when >= LOCALTIMESTAMP(0) - "
+ . $dbh->sql_interval('?', 'DAY') .
+ " GROUP BY dupe_of", {Columns=>[1,2]},
$reso_field_id, $changedsince)};
add_indirect_dups(\%since_dups, \%dupe_relation);
# Enforce the mostfreqthreshold parameter and the "bug_id" cgi param.
+my $mostfreq = Bugzilla->params->{'mostfreqthreshold'};
foreach my $id (keys %total_dups) {
- if ($total_dups{$id} < Bugzilla->params->{'mostfreqthreshold'}) {
+ if ($total_dups{$id} < $mostfreq) {
delete $total_dups{$id};
next;
}