-
Notifications
You must be signed in to change notification settings - Fork 189
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Avoid fetching unnecessary data when posting review requests.
The way the RBTools Python API works, it's annoyingly easy to make GET requests to list resources when we don't actually care about the existing data, we just want an instance of the list resource in order to to do POST operations. This change fixes `rbt post` to minimize this in two big cases: - We were fetching the review request list when creating a new review request. We had `only-fields=` on this request, so it wasn't actually serializing very much data, but it would still query and return a list of up to 25 review requests. - We were fetching up to 25 diff file attachments when we wanted to upload binary files, including all of their data. Moreover, we were doing this for each binary file we wanted to upload. With this fix, we now pass max_results=0 to the get operation. This means we'll get the proper MIME types and links which are used to do further operations, but we won't fetch any existing data from the database. The file attachments resource is now saved once instead of fetching it for each file. This also fixes up the DiffFileAttachmentListResource upload method to use the `create` link (before it would inherit the ?max-results=0 from the GET). Testing Done: Posted changes and looked carefully at the --debug output. Verified that we were no longer doing unnecessary or unnecessarily heavy API requests. Reviewed at https://reviews.reviewboard.org/r/13785/
- Loading branch information
Showing
2 changed files
with
33 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters