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-11-08 13:33:01 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2021-11-08 13:33:01 +0300
commit6edb7e9bb152d919c215f35bd6cb7d52fd3d99be (patch)
treef12ef4b7953932f9b2b9c28313277bf636115bc8 /lib/gitlab/sidekiq_middleware
parent305ea394efd2d5afe16234406dede486d9ca37af (diff)
Add latest changes from gitlab-org/gitlab@14-4-stable-ee
Diffstat (limited to 'lib/gitlab/sidekiq_middleware')
-rw-r--r--lib/gitlab/sidekiq_middleware/size_limiter/validator.rb12
1 files changed, 11 insertions, 1 deletions
diff --git a/lib/gitlab/sidekiq_middleware/size_limiter/validator.rb b/lib/gitlab/sidekiq_middleware/size_limiter/validator.rb
index a83522a489a..71316bbd243 100644
--- a/lib/gitlab/sidekiq_middleware/size_limiter/validator.rb
+++ b/lib/gitlab/sidekiq_middleware/size_limiter/validator.rb
@@ -28,15 +28,21 @@ module Gitlab
#
# The worker classes aren't constants here, because that would force
# Application Settings to be loaded earlier causing failures loading
- # the environmant in rake tasks
+ # the environment in rake tasks
EXEMPT_WORKER_NAMES = ["BackgroundMigrationWorker", "Database::BatchedBackgroundMigrationWorker"].to_set
+ JOB_STATUS_KEY = 'size_limiter'
class << self
def validate!(worker_class, job)
return if EXEMPT_WORKER_NAMES.include?(worker_class.to_s)
+ return if validated?(job)
new(worker_class, job).validate!
end
+
+ def validated?(job)
+ job.has_key?(JOB_STATUS_KEY)
+ end
end
DEFAULT_SIZE_LIMIT = 0
@@ -64,6 +70,8 @@ module Gitlab
end
def validate!
+ @job[JOB_STATUS_KEY] = 'validated'
+
job_args = compress_if_necessary(::Sidekiq.dump_json(@job['args']))
return if @size_limit == 0
@@ -72,8 +80,10 @@ module Gitlab
exception = exceed_limit_error(job_args)
if compress_mode?
+ @job.delete(JOB_STATUS_KEY)
raise exception
else
+ @job[JOB_STATUS_KEY] = 'tracked'
track(exception)
end
end