Class: MergeRequest::CleanupSchedule
- Inherits:
-
ApplicationRecord
- Object
- ActiveRecord::Base
- ApplicationRecord
- MergeRequest::CleanupSchedule
- Defined in:
- app/models/merge_request/cleanup_schedule.rb
Constant Summary collapse
- STATUSES =
{ unstarted: 0, running: 1, completed: 2, failed: 3 }.freeze
Constants inherited from ApplicationRecord
Class Method Summary collapse
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
.start_next ⇒ Object
51 52 53 54 55 56 57 58 59 60 |
# File 'app/models/merge_request/cleanup_schedule.rb', line 51 def self.start_next MergeRequest::CleanupSchedule.transaction do cleanup_schedule = scheduled_and_unstarted.lock('FOR UPDATE SKIP LOCKED').first next if cleanup_schedule.blank? cleanup_schedule.run! cleanup_schedule end end |