Class: Packages::Cleanup::Policy

Inherits:
ApplicationRecord show all
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

ApplicationRecord::MAX_PLUCK

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Schedulable

#schedule_next_run!

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

#serializable_hash

Class Method Details

.activeObject

used by Schedulable


22
23
24
# File 'app/models/packages/cleanup/policy.rb', line 22

def self.active
  where.not(keep_n_duplicated_package_files: 'all')
end

Instance Method Details

#set_next_run_atObject


26
27
28
29
# File 'app/models/packages/cleanup/policy.rb', line 26

def set_next_run_at
  # fixed cadence of 12 hours
  self.next_run_at = Time.zone.now + 12.hours
end