Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix search_content doing repeated blocking queries to /type/ #111

Merged

Conversation

rohanpm
Copy link
Member

@rohanpm rohanpm commented Aug 24, 2021

The search_content method wants to know the server's supported content
types so that it can validate requested type IDs, or set defaults if the
caller didn't request any specific type.

The way this was implemented had a couple of related minor issues:

  • there was no caching of types, so every call to search_content would
    have to do an additional call to /types/ ; this means code doing
    repeated search_content calls ends up doing 1.5..2x as many HTTP
    requests as needed (depending on the content type).

  • the handling of type_ids was written in a blocking style, which is
    inconsistent with the rest of the API aiming to support a non-blocking
    style with all operations being asynchronous.

This commit fixes the above issues for a modest performance improvement
in some cases.

The search_content method wants to know the server's supported content
types so that it can validate requested type IDs, or set defaults if the
caller didn't request any specific type.

The way this was implemented had a couple of related minor issues:

- there was no caching of types, so every call to search_content would
  have to do an additional call to /types/ ; this means code doing
  repeated search_content calls ends up doing 1.5..2x as many HTTP
  requests as needed (depending on the content type).

- the handling of type_ids was written in a blocking style, which is
  inconsistent with the rest of the API aiming to support a non-blocking
  style with all operations being asynchronous.

This commit fixes the above issues for a modest performance improvement
in some cases.
@rohanpm rohanpm marked this pull request as ready for review August 24, 2021 01:08
@rohanpm rohanpm requested a review from a team August 24, 2021 01:08
@rohanpm rohanpm merged commit 5cc8418 into release-engineering:master Aug 26, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants