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:
authorRobert Speicher <rspeicher@gmail.com>2021-01-20 22:34:23 +0300
committerRobert Speicher <rspeicher@gmail.com>2021-01-20 22:34:23 +0300
commit6438df3a1e0fb944485cebf07976160184697d72 (patch)
tree00b09bfd170e77ae9391b1a2f5a93ef6839f2597 /lib/gitlab/performance_bar
parent42bcd54d971da7ef2854b896a7b34f4ef8601067 (diff)
Add latest changes from gitlab-org/gitlab@13-8-stable-eev13.8.0-rc42
Diffstat (limited to 'lib/gitlab/performance_bar')
-rw-r--r--lib/gitlab/performance_bar/redis_adapter_when_peek_enabled.rb22
1 files changed, 19 insertions, 3 deletions
diff --git a/lib/gitlab/performance_bar/redis_adapter_when_peek_enabled.rb b/lib/gitlab/performance_bar/redis_adapter_when_peek_enabled.rb
index bf8d4b202b6..133d777fc32 100644
--- a/lib/gitlab/performance_bar/redis_adapter_when_peek_enabled.rb
+++ b/lib/gitlab/performance_bar/redis_adapter_when_peek_enabled.rb
@@ -15,23 +15,39 @@ module Gitlab
# schedules a job which parses peek profile data and adds them
# to a structured log
+ # rubocop:disable Gitlab/ModuleWithInstanceVariables
def enqueue_stats_job(request_id)
return unless gather_stats?
- @client.sadd(GitlabPerformanceBarStatsWorker::STATS_KEY, request_id) # rubocop:disable Gitlab/ModuleWithInstanceVariables
+ @client.sadd(GitlabPerformanceBarStatsWorker::STATS_KEY, request_id)
return unless uuid = Gitlab::ExclusiveLease.new(
GitlabPerformanceBarStatsWorker::LEASE_KEY,
timeout: GitlabPerformanceBarStatsWorker::LEASE_TIMEOUT
).try_obtain
- GitlabPerformanceBarStatsWorker.perform_in(GitlabPerformanceBarStatsWorker::WORKER_DELAY, uuid)
+ # stats key should be periodically processed and deleted by
+ # GitlabPerformanceBarStatsWorker but if it doesn't happen for
+ # some reason, we set expiration for the stats key to avoid
+ # keeping millions of request ids which would be already expired
+ # anyway
+ # rubocop:disable Gitlab/ModuleWithInstanceVariables
+ @client.expire(
+ GitlabPerformanceBarStatsWorker::STATS_KEY,
+ GitlabPerformanceBarStatsWorker::STATS_KEY_EXPIRE
+ )
+
+ GitlabPerformanceBarStatsWorker.perform_in(
+ GitlabPerformanceBarStatsWorker::WORKER_DELAY,
+ uuid
+ )
end
+ # rubocop:enable Gitlab/ModuleWithInstanceVariables
def gather_stats?
return unless Feature.enabled?(:performance_bar_stats)
- Gitlab.com? || !Rails.env.production?
+ Gitlab.com? || Gitlab.staging? || !Rails.env.production?
end
end
end