-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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: remove uploaded files if transaction is rolled back #2546
fix: remove uploaded files if transaction is rolled back #2546
Conversation
These tests need to be added back to ensure that this change has the effect intended in #2209. In addition to that, you need to add tests for the functionality stated in #2544. |
The tests are there. They are reverted in the first commit but re-added in the second.
The tests are already there. By reading Do you have a specific test in mind? |
Sorry I overlooked, please ignore this.
These points are stated in #2544, so we should have corresponding test cases to ensure they are resolved by this change.
|
Done. |
Would just like to echo that moving this back to a Appreciate the work on this! |
This commit attempts to fix leftover files in failed transactions, but in the process introduces three problems: - Uploader state is inconsistent between `save` and `commit`. For example, reading `my_object.file_url.url` will return a bogus url if I read before commit. - A file might not be uploaded after a successful commit. For example, if there is a network failure. This causes the transaction to not be rolled back and invalid records being recorded. - Even if the upload eventually completes, it can take an arbitrary amount of time, during which the record is invalid. This reverts commit 665f225. Fixes: carrierwaveuploader#2544
This prevents accumulating stale files when transaction is aborted.
Thank you for your work 🙌 |
This prevents accumulating stale files when transaction is aborted.
Depends on #2545 , restores functionality added by #2209