summaryrefslogtreecommitdiffstats
path: root/Bugzilla/WebService/Server
diff options
context:
space:
mode:
authorDylan William Hardison <dylan@hardison.net>2018-07-31 19:54:12 +0200
committerGitHub <noreply@github.com>2018-07-31 19:54:12 +0200
commite1b3729da40453f33a836eb75c8990cb4a42a634 (patch)
treec052bbfee879693e1fb879976863d84d2ff9c88a /Bugzilla/WebService/Server
parentd133f849672bdd7ad1b22e2ffc327fc65c2b95e8 (diff)
downloadbugzilla-e1b3729da40453f33a836eb75c8990cb4a42a634.tar.gz
bugzilla-e1b3729da40453f33a836eb75c8990cb4a42a634.tar.xz
Bug 1320977 - performance tweaks
Diffstat (limited to 'Bugzilla/WebService/Server')
-rw-r--r--Bugzilla/WebService/Server/REST.pm8
1 files changed, 6 insertions, 2 deletions
diff --git a/Bugzilla/WebService/Server/REST.pm b/Bugzilla/WebService/Server/REST.pm
index b8884b753..13896b248 100644
--- a/Bugzilla/WebService/Server/REST.pm
+++ b/Bugzilla/WebService/Server/REST.pm
@@ -34,6 +34,7 @@ use Bugzilla::WebService::Server::REST::Resources::Elastic;
use List::MoreUtils qw(uniq);
use Scalar::Util qw(blessed reftype);
use MIME::Base64 qw(decode_base64);
+use Module::Runtime qw(require_module);
###########################
# Public Method Overrides #
@@ -392,6 +393,10 @@ sub _retrieve_json_params {
return $params;
}
+sub preload {
+ require_module($_) for values %{ WS_DISPATCH() };
+}
+
sub _find_resource {
my ($self, $path) = @_;
@@ -399,13 +404,12 @@ sub _find_resource {
# $module->rest_resources to get the resources array ref.
my $resources = {};
foreach my $module (values %{ $self->{dispatch_path} }) {
- eval("require $module") || die $@;
next if !$module->can('rest_resources');
$resources->{$module} = $module->rest_resources;
}
Bugzilla::Hook::process('webservice_rest_resources',
- { rpc => $self, resources => $resources });
+ { rpc => $self, resources => $resources }) if Bugzilla::request_cache->{bzapi};
# Use the resources hash from each module loaded earlier to determine
# which handler to use based on a regex match of the CGI path.