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

Fix storage calculation when deleting multiple files at once #568

Merged
merged 1 commit into from
Mar 16, 2023

Conversation

suricactus
Copy link
Collaborator

With parallel requests, the ORM bit me again by caching the old value. I am pretty sure there must be a smarter way of incrementing and decrementing data in the DB, but what I have though so far is not super Django-ish:

This is plain ugly:

Project.objects.filter(pk=project.pk).update(file_storage_bytes=F('file_storage_bytes')+file.size)

With parallel requests, the ORM bit me again by caching the old value.
I am pretty sure there must be a smarter way of incrementing and decrementing
data in the DB, but what I have though so far is not super Django-ish:

This is plain ugly:
```
Project.objects.filter(pk=project.pk).update(file_storage_bytes=F('file_storage_bytes')+file.size)
```
@suricactus suricactus added bug Something isn't working patch Requires patch version change labels Mar 16, 2023
@duke-nyuki
Copy link
Collaborator

@suricactus suricactus merged commit 5eb4cdf into master Mar 16, 2023
@suricactus suricactus deleted the QF-2545-fix-multiple-storage branch March 16, 2023 12:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working patch Requires patch version change
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants