lato_storage 3.0.7 → 3.0.8

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: 8b3a3c172eaed5975747221e31a8d12d8ef1062fd543e5022d6c44f65dbec033
4
- data.tar.gz: 1c0698af7f7b8bb298bdcc5107c9d63e45ec7b01764abec4b34167a01d0f5a47
3
+ metadata.gz: 7052d0a8dbea49286dfc1be1303270feb89d046a5e667e47c31090fe1da58d1f
4
+ data.tar.gz: 2bf961008e489700ebcd94501bb11e36c60f6363dcb1c21b303c5ba688d27709
5
5
  SHA512:
6
- metadata.gz: e832d19f93086c0a947c09166bb4d6f97d4d24f965787f73299330df4569eb59cdc78b7327883988707e1fa97caff6e6b1be8751873ee0ece5bea52dd116ac58
7
- data.tar.gz: 183d883e09d82607c19de8281313bbfda12eb139b53c86b8dde0741fb15fddfcbad9fea9f737d72e787829268efb5dc03bcca00f44225a6013e4b630cb2fed26
6
+ metadata.gz: 5e81ee975f7ec956ca04fdc3fd434494c7c40b9c8af50886a4852eed8955e2b58c7ca5b694533f565127462465f6d08d80da4d772ef002111a6cb6a01bb0241f
7
+ data.tar.gz: fdd06ab53fe93ecd2448b0561d81353f32a9a238402896a59946015839bb7ada2408d931eaead9a9e96c051f98c085de6f3c9d43d8ebdf9d7d8d8a6de068378b
@@ -31,7 +31,16 @@ 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
- deletable_blobs_count = ActiveStorage::Blob.unattached.where('active_storage_blobs.created_at < ?', 12.hours.ago).count
34
+ # deletable_blobs_count = ActiveStorage::Blob.unattached.where('active_storage_blobs.created_at < ?', 12.hours.ago).count
35
+ deletable_blobs_count = ActiveRecord::Base.connection.execute(
36
+ <<~SQL
37
+ SELECT COUNT(*)
38
+ FROM active_storage_blobs asb
39
+ LEFT JOIN active_storage_attachments asa ON asa.blob_id = asb.id
40
+ WHERE asa.blob_id IS NULL
41
+ AND asb.created_at < '#{12.hours.ago.to_formatted_s(:db)}'
42
+ SQL
43
+ ).first['count'].to_i
35
44
  total_storage = ActiveStorage::Blob.sum(:byte_size)
36
45
  avg_storage = blobs_count.positive? ? total_storage / blobs_count : 0
37
46
  content_types = ActiveStorage::Blob.group(:content_type).count.sort_by { |_, count| -count }.first(5)
@@ -1,3 +1,3 @@
1
1
  module LatoStorage
2
- VERSION = "3.0.7"
2
+ VERSION = "3.0.8"
3
3
  end
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.7
4
+ version: 3.0.8
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-07-24 00:00:00.000000000 Z
11
+ date: 2025-07-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails