Class: Glib::PurgeUnattached::Config
- Inherits:
-
Object
- Object
- Glib::PurgeUnattached::Config
- Defined in:
- lib/glib/purge_unattached/config.rb
Overview
Global settings for Glib::PurgeUnattachedJob.
min_age is how long an unattached ActiveStorage blob must exist before
the purge may remove it. The 8-hour default leaves room for multi-step
upload flows (direct upload -> form submit -> attach) to finish before
their blob becomes eligible; apps with slower flows raise it:
# config/initializers/glib.rb
Glib::PurgeUnattached::Config.min_age = 10.hours
Deliberately NOT a setting on the job class: the job is autoloaded from app/, so an initializer-assigned value would be wiped the first time the class is reloaded. This file lives in lib/ and is required eagerly by glib-web.rb, which is what makes the setting survive reloads.
Constant Summary collapse
- DEFAULT_MIN_AGE =
The shipped default. Apps opt into a different window via the setter.
8.hours
- @@min_age =
DEFAULT_MIN_AGE
Class Method Summary collapse
Class Method Details
.min_age ⇒ Object
25 26 27 |
# File 'lib/glib/purge_unattached/config.rb', line 25 def self.min_age @@min_age end |
.min_age=(value) ⇒ Object
29 30 31 32 33 34 35 |
# File 'lib/glib/purge_unattached/config.rb', line 29 def self.min_age=(value) unless value.is_a?(ActiveSupport::Duration) && value.positive? raise ArgumentError, "Invalid min_age: #{value.inspect}. Expected a positive ActiveSupport::Duration (e.g. 10.hours)." end @@min_age = value end |