Class: Ci::FinishedPipelineChSyncEvent
- Inherits:
 - 
      ApplicationRecord
      
        
- Object
 - ActiveRecord::Base
 - ApplicationRecord
 - ApplicationRecord
 - Ci::FinishedPipelineChSyncEvent
 
 
- Includes:
 - EachBatch, FromUnion, PartitionedTable
 
- Defined in:
 - app/models/ci/finished_pipeline_ch_sync_event.rb
 
Constant Summary collapse
- PARTITION_DURATION =
 1.day
- PARTITION_CLEANUP_THRESHOLD =
 30.days
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
- .any_newer_partitions_exist?(partition, duration) ⇒ Boolean
 - .any_older_partitions_exist?(partition, duration) ⇒ Boolean
 - .detach_partition?(partition) ⇒ Boolean
 
Methods inherited from ApplicationRecord
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!, sharding_keys, #to_ability_name, underscore, where_exists, where_not_exists, with_fast_read_statement_timeout, without_order
Methods included from ResetOnColumnErrors
#reset_on_union_error, #reset_on_unknown_attribute_error
Methods included from Gitlab::SensitiveSerializableHash
Class Method Details
.any_newer_partitions_exist?(partition, duration) ⇒ Boolean
      61 62 63 64 65  | 
    
      # File 'app/models/ci/finished_pipeline_ch_sync_event.rb', line 61 def self.any_newer_partitions_exist?(partition, duration) for_partition(partition.value) .where(arel_table[:pipeline_finished_at].gt(duration.ago)) .exists? end  | 
  
.any_older_partitions_exist?(partition, duration) ⇒ Boolean
      55 56 57 58 59  | 
    
      # File 'app/models/ci/finished_pipeline_ch_sync_event.rb', line 55 def self.any_older_partitions_exist?(partition, duration) for_partition(partition.value) .where(arel_table[:pipeline_finished_at].lteq(duration.ago)) .exists? end  | 
  
.detach_partition?(partition) ⇒ Boolean
      45 46 47 48 49 50 51 52 53  | 
    
      # File 'app/models/ci/finished_pipeline_ch_sync_event.rb', line 45 def self.detach_partition?(partition) # detach partition if there are no pending events in partition return true unless pending.for_partition(partition.value).exists? # or if there are pending events, they are outside the cleanup threshold return true unless any_newer_partitions_exist?(partition, PARTITION_CLEANUP_THRESHOLD) false end  |