Class: Packages::Cleanup::Policy
- Inherits:
-
ApplicationRecord
- Object
- ActiveRecord::Base
- ApplicationRecord
- Packages::Cleanup::Policy
- Includes:
- Schedulable
- Defined in:
- app/models/packages/cleanup/policy.rb
Constant Summary collapse
- KEEP_N_DUPLICATED_PACKAGE_FILES_VALUES =
%w[all 1 10 20 30 40 50].freeze
Constants inherited from ApplicationRecord
Constants included from ResetOnUnionError
ResetOnUnionError::MAX_RESET_PERIOD
Class Method Summary collapse
-
.active ⇒ Object
used by Schedulable.
- .runnable ⇒ Object
- .with_packages ⇒ Object
Instance Method Summary collapse
Methods included from Schedulable
Methods inherited from ApplicationRecord
cached_column_list, #create_or_load_association, declarative_enum, default_select_columns, id_in, id_not_in, iid_in, pluck_primary_key, primary_key_in, #readable_by?, safe_ensure_unique, safe_find_or_create_by, safe_find_or_create_by!, #to_ability_name, underscore, where_exists, where_not_exists, with_fast_read_statement_timeout, without_order
Methods included from SensitiveSerializableHash
Class Method Details
.active ⇒ Object
used by Schedulable
21 22 23 |
# File 'app/models/packages/cleanup/policy.rb', line 21 def self.active where.not(keep_n_duplicated_package_files: 'all') end |
.runnable ⇒ Object
32 33 34 |
# File 'app/models/packages/cleanup/policy.rb', line 32 def self.runnable runnable_schedules.with_packages.order(next_run_at: :asc) end |
Instance Method Details
#keep_n_duplicated_package_files_disabled? ⇒ Boolean
41 42 43 |
# File 'app/models/packages/cleanup/policy.rb', line 41 def keep_n_duplicated_package_files_disabled? keep_n_duplicated_package_files == 'all' end |
#set_next_run_at ⇒ Object
36 37 38 39 |
# File 'app/models/packages/cleanup/policy.rb', line 36 def set_next_run_at # fixed cadence of 12 hours self.next_run_at = Time.zone.now + 12.hours end |