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

prefetch food relations #1965 #1980

Merged
merged 1 commit into from
Aug 5, 2022
Merged

Conversation

8633brown
Copy link
Contributor

This solves two n+1 problems for the FoodViewSet

@vabene1111
Copy link
Collaborator

awesome, thank you for the fix. I really need to get around to reviewing the complete search system

@vabene1111 vabene1111 merged commit a8da28f into TandoorRecipes:develop Aug 5, 2022
@8633brown
Copy link
Contributor Author

No worries. I could be wrong but I think there's some extra API calls on some of the pages from what I can see but I've not looked at any of the js side of it.

I was going to have a look at the FoodSerializer.get_substitute_onhand method next. I think this has a similar issue. I think it's requesting the on hand alternatives for every Food item it iterates over.

@vabene1111
Copy link
Collaborator

yes, there are quite a few api requests that could be consolidated.

generally speaking i am torn between completely rewriting the entire search/food/unit system or trying to dig into all the tiny things that cause performance issues (multiple calls, subsitutes, the tree system, usage count informations, ...)

@8633brown
Copy link
Contributor Author

Yeah that's fair. I was going primarily for the quick wins with what my situation is.
Which at the moment is running on a pi which is pretty slow so I figured I could muddle my way through try to help out on improving some queries (expecting it to be easier than a refactor). At least that benefits everyone quicker than I rewrite.

@vabene1111
Copy link
Collaborator

vabene1111 commented Aug 5, 2022

thats awesome, there are likely many low hanging fruits that could be implemented first before attempting a rewrite, feel free to fix anything you notice.

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.

2 participants