Class: Gitlab::BackgroundMigration::BackfillArtifactExpiryDate
- Inherits:
-
Object
- Object
- Gitlab::BackgroundMigration::BackfillArtifactExpiryDate
- Includes:
- Utils::StrongMemoize
- Defined in:
- lib/gitlab/background_migration/backfill_artifact_expiry_date.rb
Overview
Backfill expire_at for a range of Ci::JobArtifact
Constant Summary collapse
- SWITCH_DATE =
Date.new(2020, 06, 22).freeze
- OLD_ARTIFACT_AGE =
15.months
- BATCH_SIZE =
1_000
- OLD_ARTIFACT_EXPIRY_OFFSET =
3.months
- RECENT_ARTIFACT_EXPIRY_OFFSET =
1.year
Instance Method Summary collapse
Methods included from Utils::StrongMemoize
#clear_memoization, #strong_memoize, #strong_memoized?
Instance Method Details
#perform(start_id, end_id) ⇒ Object
28 29 30 31 32 33 34 35 36 |
# File 'lib/gitlab/background_migration/backfill_artifact_expiry_date.rb', line 28 def perform(start_id, end_id) Ci::JobArtifact .without_expiry_date.before_switch .between(start_id, end_id) .each_batch(of: BATCH_SIZE) do |batch| batch.old.update_all(expire_at: old_artifact_expiry_date) batch.recent.update_all(expire_at: recent_artifact_expiry_date) end end |