summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorByron Jones <glob@mozilla.com>2014-09-16 06:43:31 +0200
committerByron Jones <glob@mozilla.com>2014-09-16 06:43:31 +0200
commit164d2a87891967a7b5e3935d537319745c00599e (patch)
treec9604fc604b57febe2f18d71962277de4294cec9
parentcfb4ad901f1acc08d65f4972393b2308cf509d31 (diff)
downloadbugzilla-164d2a87891967a7b5e3935d537319745c00599e.tar.gz
bugzilla-164d2a87891967a7b5e3935d537319745c00599e.tar.xz
Bug 1039940: serialisation of objects for webservice responses is extremely slow
r=dylan,a=sgreen
-rw-r--r--Bugzilla/WebService/Bug.pm13
1 files changed, 8 insertions, 5 deletions
diff --git a/Bugzilla/WebService/Bug.pm b/Bugzilla/WebService/Bug.pm
index 0062ecc14..6525b4694 100644
--- a/Bugzilla/WebService/Bug.pm
+++ b/Bugzilla/WebService/Bug.pm
@@ -1179,13 +1179,11 @@ sub _bug_to_hash {
# A bug attribute is "basic" if it doesn't require an additional
# database call to get the info.
my %item = %{ filter $params, {
- creation_time => $self->type('dateTime', $bug->creation_ts),
# No need to format $bug->deadline specially, because Bugzilla::Bug
# already does it for us.
deadline => $self->type('string', $bug->deadline),
id => $self->type('int', $bug->bug_id),
is_confirmed => $self->type('boolean', $bug->everconfirmed),
- last_change_time => $self->type('dateTime', $bug->delta_ts),
op_sys => $self->type('string', $bug->op_sys),
platform => $self->type('string', $bug->rep_platform),
priority => $self->type('string', $bug->priority),
@@ -1199,9 +1197,8 @@ sub _bug_to_hash {
whiteboard => $self->type('string', $bug->status_whiteboard),
} };
- # First we handle any fields that require extra SQL calls.
- # We don't do the SQL calls at all if the filter would just
- # eliminate them anyway.
+ # First we handle any fields that require extra work (such as date parsing
+ # or SQL calls).
if (filter_wants $params, 'alias') {
$item{alias} = [ map { $self->type('string', $_) } @{ $bug->alias } ];
}
@@ -1224,6 +1221,9 @@ sub _bug_to_hash {
$item{'cc'} = \@cc;
$item{'cc_detail'} = [ map { $self->_user_to_hash($_, $params, undef, 'cc') } @{ $bug->cc_users } ];
}
+ if (filter_wants $params, 'creation_time') {
+ $item{'creation_time'} = $self->type('dateTime', $bug->creation_ts);
+ }
if (filter_wants $params, 'creator') {
$item{'creator'} = $self->type('email', $bug->reporter->login);
$item{'creator_detail'} = $self->_user_to_hash($bug->reporter, $params, undef, 'creator');
@@ -1248,6 +1248,9 @@ sub _bug_to_hash {
@{ $bug->keyword_objects };
$item{'keywords'} = \@keywords;
}
+ if (filter_wants $params, 'last_change_time') {
+ $item{'last_change_time'} = $self->type('dateTime', $bug->delta_ts);
+ }
if (filter_wants $params, 'product') {
$item{product} = $self->type('string', $bug->product);
}