PERF: Faster disk space calculation on upload heavy instances (#28307)

This commit is contained in:
overgrow 2024-10-24 12:11:40 +02:00 committed by GitHub
parent ab7547eb7a
commit 95d8ed59db
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -2,11 +2,7 @@
class DiskSpace class DiskSpace
def self.uploads_used_bytes def self.uploads_used_bytes
if Discourse.store.external?
Upload.sum(:filesize).to_i + OptimizedImage.sum(:filesize).to_i Upload.sum(:filesize).to_i + OptimizedImage.sum(:filesize).to_i
else
used(uploads_path)
end
end end
def self.uploads_free_bytes def self.uploads_free_bytes