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

Regroup storage counter calculation in the same DB transaction #897

Merged
merged 4 commits into from Oct 4, 2023

Conversation

noliveleger
Copy link
Contributor

@noliveleger noliveleger commented Oct 4, 2023

Description

Avoid discrepancy when something goes wrong (e.g. one counter is decreased but not the other)

Notes

Use default_storage_class to get rid of the file on storage instead of letting the FileField media_file handle it.
As explained in the comments of this PR, attachment.media_file.delete() could rise to a race condition on counter update.

 to keep counters update in the same transaction
@noliveleger noliveleger assigned LMNTL and noliveleger and unassigned LMNTL Oct 4, 2023
@noliveleger noliveleger marked this pull request as ready for review October 4, 2023 18:55
@LMNTL LMNTL merged commit eff5fdc into release/2.023.37 Oct 4, 2023
1 check passed
@LMNTL LMNTL deleted the regroup-attachment-signals branch October 4, 2023 19:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants