Class: Ci::PipelineArtifacts::DestroyAllExpiredService
- Inherits:
-
Object
- Object
- Ci::PipelineArtifacts::DestroyAllExpiredService
- Includes:
- Gitlab::ExclusiveLeaseHelpers, Gitlab::LoopHelpers, Gitlab::Utils::StrongMemoize
- Defined in:
- app/services/ci/pipeline_artifacts/destroy_all_expired_service.rb
Constant Summary collapse
- BATCH_SIZE =
100
- LOOP_LIMIT =
1000
- LOOP_TIMEOUT =
5.minutes
- LOCK_TIMEOUT =
10.minutes
- EXCLUSIVE_LOCK_KEY =
'expired_pipeline_artifacts:destroy:lock'
Constants included from Gitlab::ExclusiveLeaseHelpers
Gitlab::ExclusiveLeaseHelpers::FailedToObtainLockError
Instance Method Summary collapse
- #execute ⇒ Object
-
#initialize ⇒ DestroyAllExpiredService
constructor
A new instance of DestroyAllExpiredService.
Methods included from Gitlab::LoopHelpers
Methods included from Gitlab::ExclusiveLeaseHelpers
Constructor Details
#initialize ⇒ DestroyAllExpiredService
Returns a new instance of DestroyAllExpiredService.
16 17 18 19 |
# File 'app/services/ci/pipeline_artifacts/destroy_all_expired_service.rb', line 16 def initialize @removed_artifacts_count = 0 @start_at = Time.current end |
Instance Method Details
#execute ⇒ Object
21 22 23 24 25 26 27 28 29 |
# File 'app/services/ci/pipeline_artifacts/destroy_all_expired_service.rb', line 21 def execute in_lock(EXCLUSIVE_LOCK_KEY, ttl: LOCK_TIMEOUT, retries: 1) do destroy_unlocked_pipeline_artifacts legacy_destroy_pipeline_artifacts end @removed_artifacts_count end |