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>2019-11-20 18:06:39 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2019-11-20 18:06:39 +0300
commit97b63407ef0ecacc239fe320a9b87eefdebfe70c (patch)
tree64f9ab65e07bee7d37c1559e59e1607dc819cfe1 /lib/gitlab/chaos.rb
parenta68e9d3318c6847436f81f83eb347b29f52d1bff (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'lib/gitlab/chaos.rb')
-rw-r--r--lib/gitlab/chaos.rb6
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/gitlab/chaos.rb b/lib/gitlab/chaos.rb
index 4f47cdef971..911f2993b8a 100644
--- a/lib/gitlab/chaos.rb
+++ b/lib/gitlab/chaos.rb
@@ -19,9 +19,11 @@ module Gitlab
# cpu_spin will consume all CPU on a single core for the specified duration
def self.cpu_spin(duration_s)
- expected_end_time = Time.now + duration_s
+ return unless Gitlab::Metrics::System.thread_cpu_time
+
+ expected_end_time = Gitlab::Metrics::System.thread_cpu_time + duration_s
- rand while Time.now < expected_end_time
+ rand while Gitlab::Metrics::System.thread_cpu_time < expected_end_time
end
# db_spin will query the database in a tight loop for the specified duration