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
- STUCK_RETRY_LIMIT =
NOTE: Limit the number of stuck schedule jobs to retry just in case it becomes too big.
5
Constants inherited from ApplicationRecord
Constants included from HasCheckConstraints
HasCheckConstraints::NOT_NULL_CHECK_PATTERN
Constants included from ResetOnColumnErrors
ResetOnColumnErrors::MAX_RESET_PERIOD
Class Method Summary collapse
Methods inherited from ApplicationRecord
===, cached_column_list, #create_or_load_association, current_transaction, declarative_enum, default_select_columns, delete_all_returning, #deleted_from_database?, id_in, id_not_in, iid_in, nullable_column?, 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 Organizations::Sharding
Methods included from ResetOnColumnErrors
#reset_on_union_error, #reset_on_unknown_attribute_error
Methods included from Gitlab::SensitiveSerializableHash
Class Method Details
.start_next ⇒ Object
59 60 61 62 63 64 65 66 67 68 |
# File 'app/models/merge_request/cleanup_schedule.rb', line 59 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 |
.stuck_retry! ⇒ Object
70 71 72 |
# File 'app/models/merge_request/cleanup_schedule.rb', line 70 def self.stuck_retry! self.stuck.limit(STUCK_RETRY_LIMIT).map(&:retry!) end |