using include_fields results in an extraneous request to bugzilla

RESOLVED FIXED

Status

RESOLVED FIXED
6 years ago
2 months ago

People

(Reporter: glob, Assigned: gerv)

Tracking

Details

(Reporter)

Description

6 years ago
the query:

https://api-dev.bugzilla.mozilla.org/latest/bug?whiteboard=orange&include_fields=id,resolution&summary=browser_frameworker.js&order=resolution

results in two queries on bugzilla:

buglist.cgi?order=resolution&short_desc=browser_frameworker.js&status_whiteboard=orange&short_desc_type=allwordssubstr&status_whiteboard_type=allwordssubstr&columnlist=resolution%2Cbug_id&ctype=csv

show_bug.cgi?id=766826%2C797874%2C776554&ctype=xml&excludefield=attachmentdata&excludefield=long_desc

if include_fields isn't specified, only the buglist.cgi query is executed.


i think the problem may be at http://hg.mozilla.org/webtools/bzapi/file/eec0b8d574b8/lib/Bugzilla/API/Model/Bug.pm#l129
> if (!$result->{'bugs'}->[0]->{$include_field}) {

if a field is set, but contains a value which evaluates to false, this will trigger the second fetch.  perhaps this should be:

> if (!exists $result->{'bugs'}->[0]->{$include_field}) {
You are quite right.

Gerv
committed changeset 177:45117e70a5cd .

glob: how much of an impact is this having? Is it urgent that the fix makes its way to api-dev soon?

Gerv
Never mind - I've seen the other two bugs this causes. This is now deployed on /latest, and will be in a 1.2 release, whenever that happens.

Gerv
Status: NEW → RESOLVED
Last Resolved: 6 years ago
Resolution: --- → FIXED

Comment 4

6 years ago
Thank you Gerv! :-)

Glob, I would be curious to know how many of the 50000 daily b.m.o requests from BzAPI specify "&include_fields=.*resolution". I would imagine most use-cases of bzapi involve at least fetching summary/status/resolution, so this would cause double calls quite a bit of the time surely? (Presuming many people even bother to specify include_fields).
OS: Mac OS X → All
Hardware: x86 → All
(Reporter)

Comment 5

6 years ago
thanks gerv :)

on 2012-10-11, 11% bzapi buglist.cgi requests specified resolution as an include_field (3397 of 30437 requests).

Updated

2 months ago
Product: Webtools → Webtools Graveyard
You need to log in before you can comment on or make changes to this bug.