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

Optimize jobs-list endpoint with push_id filter #7827

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

vrigal
Copy link
Collaborator

@vrigal vrigal commented Oct 5, 2023

This endpoint cannot be simplified much, as built with a viewset + django-filters.

The majority of requests use the push_id__in filter, which performs a single lookup query (50+% of the requests compare with a single push ID using the __in clause).
However, 10% of the overall queries uses the push_id filter directly (you can see thoses request when loading the app main page), which cause an extra query to fetch the push entry before listing related jobs.

This implementation cuts off this extra query, improving perf by approx. 12% (389ms → 341ms).
On the other side, the API will return an empty jobs list when filtering with a wrong ID, instead of returning an explicit message (that was "push_id": ["Select a valid choice. That choice is not one of the available choices."]).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants