Skip to content

Conversation

@kyoshino
Copy link
Collaborator

Fix Bug 1320977 - Add review/feedback/needinfo request counts and block statuses to /rest/user and /rest/user/suggest responses

Example

/rest/user/suggest will look like this:

{
   "users" : [
      {
         "id" : 1,
         "name" : "[email protected]",
         "real_name" : "Vagrant Nakamoto",
         "requests" : {
            "feedback" : {
               "blocked" : false,
               "pending" : 0
            },
            "needinfo" : {
               "blocked" : true,
               "pending" : 0
            },
            "review" : {
               "blocked" : false,
               "pending" : 1
            }
         }
      }
   ]
}

…tatuses to /rest/user and /rest/user/suggest responses
@kyoshino kyoshino added the perl review this PR needs someone that can review perl label Jul 25, 2018
@kyoshino kyoshino self-assigned this Jul 25, 2018
@kyoshino
Copy link
Collaborator Author

kyoshino commented Jul 27, 2018

Not sure if this makes /rest/user/suggest a bit slow. @dylanwh is this okay for you? We have to add request statuses to API responses anyway.

@kyoshino kyoshino requested a review from dylanwh July 27, 2018 14:17
@dylanwh
Copy link
Contributor

dylanwh commented Jul 27, 2018

I'll do some benchmarks. I think we can avoid using $webservice->type() for some speed gains.
The only downside is XMLRPC won't work but we don't care about that.

For $webservice->type('boolean', $val) do $val ? JSON::MaybeXS->true : JSON::MaybeXS->false
For $webservice->type('int', $val) do int($val)

@dylanwh
Copy link
Contributor

dylanwh commented Jul 27, 2018

This would have added 8ms:

spent 8.16ms (158µs+8.00) within Bugzilla::Extension::Review::webservice_user_get

screen shot 2018-07-27 at 12 49 50

But I made it better:

spent 3.87ms (127µs+3.74) within Bugzilla::Extension::Review::webservice_user_get

screen shot 2018-07-27 at 12 49 33

I'll post those changes shortly.

Copy link
Contributor

@dylanwh dylanwh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll approve this and make another PR for making it faster.

@dylanwh dylanwh merged commit f3f85f5 into mozilla-bteam:master Jul 27, 2018
@kyoshino kyoshino deleted the bug-1320977-api-user-requests branch July 27, 2018 21:41
@kyoshino kyoshino added the API API bugs and enhancements label Aug 29, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

API API bugs and enhancements perl review this PR needs someone that can review perl

Development

Successfully merging this pull request may close these issues.

2 participants