summaryrefslogtreecommitdiffstats
path: root/Bugzilla/WebService/Bug.pm
diff options
context:
space:
mode:
authorByron Jones <glob@mozilla.com>2014-09-16 06:45:58 +0200
committerByron Jones <glob@mozilla.com>2014-09-16 06:45:58 +0200
commit64808c867b1fe6ac2b8fc81d951821f602e7bea2 (patch)
treed39fb2439b211d22e7b9cf3f5bbbbacbb2616db8 /Bugzilla/WebService/Bug.pm
parentd898380623e141b87793657887354d0a381c0867 (diff)
downloadbugzilla-64808c867b1fe6ac2b8fc81d951821f602e7bea2.tar.gz
bugzilla-64808c867b1fe6ac2b8fc81d951821f602e7bea2.tar.xz
Bug 1039940: serialisation of objects for webservice responses is extremely slow
Diffstat (limited to 'Bugzilla/WebService/Bug.pm')
-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 319df7578..4f5b4c39c 100644
--- a/Bugzilla/WebService/Bug.pm
+++ b/Bugzilla/WebService/Bug.pm
@@ -1261,10 +1261,8 @@ sub _bug_to_hash {
# database call to get the info.
my %item = %{ filter $params, {
alias => $self->type('string', $bug->alias),
- creation_time => $self->type('dateTime', $bug->creation_ts),
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),
@@ -1278,9 +1276,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, 'assigned_to') {
$item{'assigned_to'} = $self->type('email', $bug->assigned_to->login);
$item{'assigned_to_detail'} = $self->_user_to_hash($bug->assigned_to, $params, undef, 'assigned_to');
@@ -1300,6 +1297,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');
@@ -1324,6 +1324,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);
}