lato_storage 3.0.10 → 3.0.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c71b1febc77599f2102e8867cf05e9db5f8b4395a7e47be7946bb755f4162658
|
4
|
+
data.tar.gz: b8c6966bceb00b773660a66b09c46589e9445587b1a9b5500be0c3b20bfc5c61
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3515cdd2f6075a8392bb7e5b4b781bbc84eda3c6eb923c54534e8e17cb4a9de31a18759680add18c180c1bfb33be317cede90b2472f0e76187f8dfaa7f2e6004
|
7
|
+
data.tar.gz: 29e63807d0d2e0b896e2dfc3c1dce3f5debc1c0ac73c9093378f68e23af8dbc36e116b16886ab060d4852cb3a4dca303f115b7a2735aee64e06e6dcf11436449
|
@@ -31,10 +31,7 @@ module LatoStorage
|
|
31
31
|
blobs_count = ActiveStorage::Blob.count
|
32
32
|
attachments_count = ActiveStorage::Attachment.count
|
33
33
|
variant_records_count = defined?(ActiveStorage::VariantRecord) ? ActiveStorage::VariantRecord.count : 0
|
34
|
-
|
35
|
-
deletable_blobs_count = ActiveStorage::Blob.joins("LEFT JOIN active_storage_attachments ON active_storage_attachments.blob_id = active_storage_blobs.id")
|
36
|
-
.where("active_storage_attachments.blob_id IS NULL")
|
37
|
-
.where("active_storage_blobs.created_at < ?", 12.hours.ago).count
|
34
|
+
deletable_blobs_count = deletable_blobs_count_loader
|
38
35
|
total_storage = ActiveStorage::Blob.sum(:byte_size)
|
39
36
|
avg_storage = blobs_count.positive? ? total_storage / blobs_count : 0
|
40
37
|
content_types = ActiveStorage::Blob.group(:content_type).count.sort_by { |_, count| -count }.first(5)
|
@@ -62,5 +59,13 @@ module LatoStorage
|
|
62
59
|
largest_blobs: largest_blobs
|
63
60
|
}
|
64
61
|
end
|
62
|
+
|
63
|
+
def deletable_blobs_count_loader
|
64
|
+
count = 0
|
65
|
+
ActiveStorage::Blob.left_joins(:attachments).where(active_storage_attachments: { blob_id: nil }).where('active_storage_blobs.created_at < ?', 12.hours.ago).find_each(batch_size: 1000) do |blob|
|
66
|
+
count += 1
|
67
|
+
end
|
68
|
+
count
|
69
|
+
end
|
65
70
|
end
|
66
71
|
end
|
data/lib/lato_storage/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: lato_storage
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.0.
|
4
|
+
version: 3.0.11
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Gregorio Galante
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2025-
|
11
|
+
date: 2025-09-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|