Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2021-02-18 13:34:06 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2021-02-18 13:34:06 +0300
commit859a6fb938bb9ee2a317c46dfa4fcc1af49608f0 (patch)
treed7f2700abe6b4ffcb2dcfc80631b2d87d0609239 /lib/gitlab/cleanup
parent446d496a6d000c73a304be52587cd9bbc7493136 (diff)
Add latest changes from gitlab-org/gitlab@13-9-stable-eev13.9.0-rc42
Diffstat (limited to 'lib/gitlab/cleanup')
-rw-r--r--lib/gitlab/cleanup/orphan_job_artifact_files.rb15
-rw-r--r--lib/gitlab/cleanup/orphan_lfs_file_references.rb9
2 files changed, 17 insertions, 7 deletions
diff --git a/lib/gitlab/cleanup/orphan_job_artifact_files.rb b/lib/gitlab/cleanup/orphan_job_artifact_files.rb
index 6d18f9070cc..48a1ab23fc2 100644
--- a/lib/gitlab/cleanup/orphan_job_artifact_files.rb
+++ b/lib/gitlab/cleanup/orphan_job_artifact_files.rb
@@ -12,10 +12,9 @@ module Gitlab
VALID_NICENESS_LEVELS = %w{none realtime best-effort idle}.freeze
attr_accessor :batch, :total_found, :total_cleaned
- attr_reader :limit, :dry_run, :niceness, :logger
+ attr_reader :dry_run, :niceness, :logger
- def initialize(limit: nil, dry_run: true, niceness: nil, logger: nil)
- @limit = limit
+ def initialize(dry_run: true, niceness: nil, logger: nil)
@dry_run = dry_run
@niceness = (niceness || DEFAULT_NICENESS).downcase
@logger = logger || Gitlab::AppLogger
@@ -31,7 +30,11 @@ module Gitlab
batch << artifact_file
clean_batch! if batch.full?
- break if limit_reached?
+
+ if limit_reached?
+ log_info("Exiting due to reaching limit of #{limit}.")
+ break
+ end
end
clean_batch!
@@ -128,6 +131,10 @@ module Gitlab
def log_error(msg, params = {})
logger.error(msg)
end
+
+ def limit
+ ENV['LIMIT']&.to_i
+ end
end
end
end
diff --git a/lib/gitlab/cleanup/orphan_lfs_file_references.rb b/lib/gitlab/cleanup/orphan_lfs_file_references.rb
index a6638b2cbc8..99e7550629a 100644
--- a/lib/gitlab/cleanup/orphan_lfs_file_references.rb
+++ b/lib/gitlab/cleanup/orphan_lfs_file_references.rb
@@ -5,15 +5,14 @@ module Gitlab
class OrphanLfsFileReferences
include Gitlab::Utils::StrongMemoize
- attr_reader :project, :dry_run, :logger, :limit
+ attr_reader :project, :dry_run, :logger
DEFAULT_REMOVAL_LIMIT = 1000
- def initialize(project, dry_run: true, logger: nil, limit: nil)
+ def initialize(project, dry_run: true, logger: nil)
@project = project
@dry_run = dry_run
@logger = logger || Gitlab::AppLogger
- @limit = limit
end
def run!
@@ -67,6 +66,10 @@ module Gitlab
def log_info(msg)
logger.info("#{'[DRY RUN] ' if dry_run}#{msg}")
end
+
+ def limit
+ ENV['LIMIT']&.to_i
+ end
end
end
end