Class: Ci::PipelineArtifacts::DestroyAllExpiredService

Inherits:
Object
  • Object
show all
Includes:
Gitlab::LoopHelpers, Gitlab::Utils::StrongMemoize
Defined in:
app/services/ci/pipeline_artifacts/destroy_all_expired_service.rb

Constant Summary collapse

BATCH_SIZE =
100
LOOP_TIMEOUT =
5.minutes
LOOP_LIMIT =
1000

Instance Method Summary collapse

Methods included from Gitlab::Utils::StrongMemoize

#clear_memoization, #strong_memoize, #strong_memoized?

Methods included from Gitlab::LoopHelpers

#loop_until

Constructor Details

#initializeDestroyAllExpiredService

Returns a new instance of DestroyAllExpiredService.


13
14
15
# File 'app/services/ci/pipeline_artifacts/destroy_all_expired_service.rb', line 13

def initialize
  @removed_artifacts_count = 0
end

Instance Method Details

#executeObject


17
18
19
20
21
22
23
# File 'app/services/ci/pipeline_artifacts/destroy_all_expired_service.rb', line 17

def execute
  loop_until(timeout: LOOP_TIMEOUT, limit: LOOP_LIMIT) do
    destroy_artifacts_batch
  end

  @removed_artifacts_count
end