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] - Multiple patch requests to recipe will duplicate ingredients and steps #2808

Open
5 of 6 tasks
RealFoxie opened this issue Dec 9, 2023 · 6 comments
Open
5 of 6 tasks
Labels
bug: confirmed bug Something isn't working

Comments

@RealFoxie
Copy link
Contributor

First Check

  • This is not a feature request.
  • I added a very descriptive title to this issue.
  • 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?

When doing multiple PATCH requests with a description as payload, the recipe ingredients and steps are duplicated.

Note:
The bug happens with payload to set the description, but might happen with other payloads too
The bug happens with a parsed ingredient, but might happen with any sort of ingredient.
My foods do have extra data and the sorts. If not reproduceable, I can give more details how the data looks on my end.

Steps to Reproduce

  1. Create a recipe with an (parsed) ingredient and one step
  2. do three PATCH requests with a change for description as payload AT THE SAME TIME
  3. they will all resolve, but the recipe will have duplications of the ingredients and steps (in this case three times).

Please provide relevant logs

Mealie Version

Latest nightly

Deployment

Docker (Linux)

Additional Deployment Details

No response

@RealFoxie RealFoxie added bug Something isn't working triage labels Dec 9, 2023
Copy link
Contributor

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@github-actions github-actions bot added the stale label Jan 24, 2024
@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Jan 30, 2024
@RealFoxie
Copy link
Contributor Author

Pretty sure this is still a bug :)

@Kuchenpirat
Copy link
Collaborator

Hey thanks @RealFoxie for redirecting some attention back here.
I was able to recreate your issue. The circumstances have to be verry specific. The second request has to hit before the first request has finished being handled. And the only field i was able to use from the few i tested was the description field.

I used a little shell script:

for i in {1..3}
do
    curl -X 'PATCH' \
    'http://localhost:3000/api/<recipe-slug>?group_id=<group-id>' \
    ......
    -d '{ "description": "Test" }' & 
done

It does not matter whether the ingredients are parsed or not.

@Kuchenpirat
Copy link
Collaborator

@RealFoxie how did you encounter any of this? I am not sure how a user would run against that wall, of the request not yet being handled, before sending another one.

@RealFoxie
Copy link
Contributor Author

I have my own script that updates the description to put in the recipe price for every recipe I plan on a week.
Sometimes I plan a recipe two times in a week, where my script would update the description two times. Instead of doing them all concurrently in the background, I now await the various update requests to avoid this issue.
This could in theory still happen if two users try to do an update action at the same time? But I'm guessing the chance the request being at the same time is very small then.

@RealFoxie
Copy link
Contributor Author

I also think that the dupplications might have the same id or similar? It has been a while, but I remember that e.g. Ingredient links would be linked to all the duplicated steps, instead of just the one I chose.

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

No branches or pull requests

2 participants