lato 0.1.54 → 0.1.55
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 +4 -4
- data/app/jobs/lato/active_storage_cleaner_job.rb +23 -0
- data/app/jobs/lato/lato_operations_cleaner_job.rb +10 -0
- data/lib/lato/version.rb +1 -1
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bddbeebbf58389bbaa2b00ac2a65601c6ffcb6e0e8fa27a1e9356772402f57ae
|
4
|
+
data.tar.gz: f95b7ad34bbfae1e2fa7de77db3e9f221b5eaee75ee2ae891d89f1b63c79a37e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6e1fb8d4ef80953ac3db25e40664249c584274ca0b94352d271571308e83dcfa0c036c0f6e7f113f4f6d2d56acdaf01efa854632c617da414ea1da2bda06f282
|
7
|
+
data.tar.gz: dce3ead8505f7a0bdeabf6ded6d821decda79f99ad988ae91031de2183ce6745c87d926d8a17877e4671778cf90d553fec2f4dcb4ed4398028224220b92eb611
|
@@ -0,0 +1,23 @@
|
|
1
|
+
module Lato
|
2
|
+
class ActiveStorageCleanerJob < Lato::ApplicationJob
|
3
|
+
def perform
|
4
|
+
# delete all active storage blobs that are not attached to any record with more than 12 hours of life
|
5
|
+
ActiveStorage::Blob.unattached.where('active_storage_blobs.created_at < ?', 12.hours.ago).find_in_batches do |blobs|
|
6
|
+
blobs.each(&:purge_later)
|
7
|
+
end
|
8
|
+
|
9
|
+
# delete all empty folders in active storage local service (if exists)
|
10
|
+
if ActiveStorage::Blob.service.is_a?(ActiveStorage::Service::DiskService)
|
11
|
+
storage_folder = ActiveStorage::Blob.service.root
|
12
|
+
return unless File.directory?(storage_folder)
|
13
|
+
|
14
|
+
Dir.foreach(storage_folder) do |folder|
|
15
|
+
next if folder == '.' || folder == '..'
|
16
|
+
|
17
|
+
folder_path = File.join(ActiveStorage::Blob.service.root, folder)
|
18
|
+
FileUtils.rm_rf(folder_path) if File.directory?(folder_path) && Dir.empty?(folder_path)
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,10 @@
|
|
1
|
+
module Lato
|
2
|
+
class LatoOperationsCleanerJob < Lato::ApplicationJob
|
3
|
+
def perform
|
4
|
+
# delete all operations that are not running and are older than 12 hours
|
5
|
+
Lato::Operation.where.not(status: :running).where('lato_operations.created_at < ?', 12.hours.ago).find_in_batches do |operations|
|
6
|
+
operations.each(&:destroy)
|
7
|
+
end
|
8
|
+
end
|
9
|
+
end
|
10
|
+
end
|
data/lib/lato/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: lato
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.55
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Gregorio Galante
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-
|
11
|
+
date: 2023-05-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -129,7 +129,9 @@ files:
|
|
129
129
|
- app/controllers/lato/operations_controller.rb
|
130
130
|
- app/helpers/lato/application_helper.rb
|
131
131
|
- app/helpers/lato/components_helper.rb
|
132
|
+
- app/jobs/lato/active_storage_cleaner_job.rb
|
132
133
|
- app/jobs/lato/application_job.rb
|
134
|
+
- app/jobs/lato/lato_operations_cleaner_job.rb
|
133
135
|
- app/mailers/lato/application_mailer.rb
|
134
136
|
- app/mailers/lato/invitation_mailer.rb
|
135
137
|
- app/mailers/lato/user_mailer.rb
|