[Rt-commit] rt branch 5.0/cache-custom-date-ranges-in-column-map created. rt-5.0.1-608-gfcacd1e93f
BPS Git Server
git at git.bestpractical.com
Fri Aug 20 20:40:36 UTC 2021
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "rt".
The branch, 5.0/cache-custom-date-ranges-in-column-map has been created
at fcacd1e93f557bf7307bc3d2459f6c8c416d1797 (commit)
- Log -----------------------------------------------------------------
commit fcacd1e93f557bf7307bc3d2459f6c8c416d1797
Author: sunnavy <sunnavy at bestpractical.com>
Date: Sat Aug 21 04:20:00 2021 +0800
Cache CustomDateRanges in ColumnMap for performance
This is mainly to reduce "Pref-CustomDateRanges" attribute searches.
diff --git a/share/html/Elements/RT__Asset/ColumnMap b/share/html/Elements/RT__Asset/ColumnMap
index 467cf60cf5..845fa85851 100644
--- a/share/html/Elements/RT__Asset/ColumnMap
+++ b/share/html/Elements/RT__Asset/ColumnMap
@@ -113,12 +113,17 @@ my $COLUMN_MAP = {
},
};
-my %ranges = RT::Asset->CustomDateRanges;
-for my $name (keys %ranges) {
+my $ranges = $m->notes('custom_date_ranges');
+if ( !$ranges ) {
+ $ranges = { RT::Asset->CustomDateRanges };
+ $m->notes( custom_date_ranges => $ranges );
+}
+
+for my $name (keys %$ranges) {
$COLUMN_MAP->{$name} = {
title => $name,
value => sub {
- $_[0]->CustomDateRange($name, $ranges{$name});
+ $_[0]->CustomDateRange($name, $ranges->{$name});
},
};
}
diff --git a/share/html/Elements/RT__Ticket/ColumnMap b/share/html/Elements/RT__Ticket/ColumnMap
index 9a98d13b1d..6c9a344cce 100644
--- a/share/html/Elements/RT__Ticket/ColumnMap
+++ b/share/html/Elements/RT__Ticket/ColumnMap
@@ -430,12 +430,17 @@ if ( RT->Config->Get('EnablePriorityAsString') ) {
}
}
-my %ranges = RT::Ticket->CustomDateRanges;
-for my $name (keys %ranges) {
+my $ranges = $m->notes('custom_date_ranges');
+if ( !$ranges ) {
+ $ranges = { RT::Ticket->CustomDateRanges };
+ $m->notes( custom_date_ranges => $ranges );
+}
+
+for my $name (keys %$ranges) {
$COLUMN_MAP->{$name} = {
title => $name,
value => sub {
- $_[0]->CustomDateRange($name, $ranges{$name});
+ $_[0]->CustomDateRange($name, $ranges->{$name});
},
};
}
-----------------------------------------------------------------------
hooks/post-receive
--
rt
More information about the rt-commit
mailing list