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

[BUG] Too many requests to /api/foods, /api/units slow the page down #3335

Closed
6 tasks done
mechanarchy opened this issue Mar 18, 2024 · 3 comments
Closed
6 tasks done
Labels
bug Something isn't working triage

Comments

@mechanarchy
Copy link

mechanarchy commented Mar 18, 2024

First Check

  • This is not a feature request.
  • I added a very descriptive title to this issue (title field is above this).
  • I used the GitHub search to find a similar issue and didn't find it.
  • I searched the Mealie documentation, with the integrated search.
  • I already read the docs and didn't find an answer.
  • This issue can be replicated on the demo site (https://demo.mealie.io/).

What is the issue you are experiencing?

It looks like many duplicated requests to /api/foods and /api/units are made from the front end (when ingredient data is loaded) when you click into the recipe edit button on a recipe page. The first couple respond effectively instantly; the rest take 60 seconds/1 minute to either respond with 200 OK or 500 Internal Server Error.

However, any other actions (that need the server) on the page are blocked until these replies are received.

Steps to Reproduce

  1. Go to the demo site
  2. Make sure food and unit information is already populated
  3. Go to a recipe page. eg at time of writing, https://demo.mealie.io/g/home/r/cheesy-beef-creamy-pesto-burger-with-sweet-potato-fries-caramelised-onions
  4. F12 to open developer tools and go to the network tab, then Ctrl+F5 to ensure your cache is clean
  5. Click the Edit button
  6. Observe many many requests. Here is what it looks like on my end, filtered to XHR only:
    image

Please provide relevant logs

There aren't any relevant logs on my own install, and I don't have access to the logs from the demo site.

Mealie Version

Self-hosted: v1.3.2 / b54cdf6
Demo site: nightly / e84e5e2

Deployment

Docker (Linux)

Additional Deployment Details

I thought it may have been my reverse proxy (Caddy), but since it's appearing on the demo site too it's unlikely this is a misconfiguration on my side. Browser Firefox 115.0.2 (64-bit) on Ubuntu.

@mechanarchy mechanarchy added bug Something isn't working triage labels Mar 18, 2024
@mechanarchy
Copy link
Author

It looks like there's one pair of /api/units + /api/foods calls made per ingredient in the recipe editor. In the case of the recipe in the steps to reproduce, there's 13 ingredients so a total of 26 API calls.

Oh. Looks like this might be fixed by #3306.

@michael-genson
Copy link
Collaborator

It looks like there's one pair of /api/units + /api/foods calls made per ingredient in the recipe editor

Yup, that's exactly what's going on. But yes, #3306 fixed it.

FYI there's a similar bug (currently only in nightly) on the home page with /group/self and there is an open PR to fix that: #3321

@mechanarchy
Copy link
Author

Thanks. I'll close this issue given it's fixed in master, (presumably) pending next release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working triage
Projects
None yet
Development

No branches or pull requests

2 participants