summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDylan William Hardison <dylan@hardison.net>2018-10-13 06:33:48 +0200
committerGitHub <noreply@github.com>2018-10-13 06:33:48 +0200
commit6657fa9f5210d5b5a9b14c0cba6882bd56232054 (patch)
treebffd7e9ae92395f97f271b70d21cb4f474d50605
parent5f5d1a83c44a7521622686e8e0a88a744e92c335 (diff)
downloadbugzilla-6657fa9f5210d5b5a9b14c0cba6882bd56232054.tar.gz
bugzilla-6657fa9f5210d5b5a9b14c0cba6882bd56232054.tar.xz
Bug 1495741 - memory issues: use local flag cache
-rw-r--r--Bugzilla/WebService/Product.pm12
1 files changed, 7 insertions, 5 deletions
diff --git a/Bugzilla/WebService/Product.pm b/Bugzilla/WebService/Product.pm
index 8ee6ff43f..cdd8a0a92 100644
--- a/Bugzilla/WebService/Product.pm
+++ b/Bugzilla/WebService/Product.pm
@@ -64,6 +64,7 @@ sub get_accessible_products {
}
# Get a list of actual products, based on list of ids or names
+our %FLAG_CACHE;
sub get {
my ($self, $params) = validate(@_, 'ids', 'names', 'type');
my $user = Bugzilla->user;
@@ -136,6 +137,7 @@ sub get {
}
# Now create a result entry for each.
+ local %FLAG_CACHE = ();
my @products = map { $self->_product_to_hash($params, $_) }
@requested_products;
return { products => \@products };
@@ -229,11 +231,11 @@ sub _component_to_hash {
$field_data->{flag_types} = {
bug =>
[map {
- $self->_flag_type_to_hash($_)
+ $FLAG_CACHE{ $_->id } //= $self->_flag_type_to_hash($_)
} @{$component->flag_types->{'bug'}}],
attachment =>
[map {
- $self->_flag_type_to_hash($_)
+ $FLAG_CACHE{ $_->id } //= $self->_flag_type_to_hash($_)
} @{$component->flag_types->{'attachment'}}],
};
}
@@ -242,8 +244,8 @@ sub _component_to_hash {
}
sub _flag_type_to_hash {
- my ($self, $flag_type, $params) = @_;
- return filter $params, {
+ my ($self, $flag_type) = @_;
+ return {
id =>
$self->type('int', $flag_type->id),
name =>
@@ -266,7 +268,7 @@ sub _flag_type_to_hash {
$self->type('int', $flag_type->grant_group_id),
request_group =>
$self->type('int', $flag_type->request_group_id),
- }, undef, 'flag_types';
+ };
}
sub _version_to_hash {