diff options
author | Pawel Chojnacki <pawel@chojnacki.ws> | 2017-05-25 21:53:42 +0300 |
---|---|---|
committer | Pawel Chojnacki <pawel@chojnacki.ws> | 2017-05-25 22:59:57 +0300 |
commit | a0497a7bc0726dfc7bc1b0f5568f0353436e128b (patch) | |
tree | 93ec6c042d62b5ba4f4a6fc3afabcef5197b0c31 /lib | |
parent | 8067efdf3dab2b8f7e3893a49248243958948dfb (diff) |
Move helpers to spec file, use const's instead of helper methods
Diffstat (limited to 'lib')
-rw-r--r-- | lib/gitlab/health_checks/fs_shards_check.rb | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/lib/gitlab/health_checks/fs_shards_check.rb b/lib/gitlab/health_checks/fs_shards_check.rb index 90612af3d63..e78b7f22e03 100644 --- a/lib/gitlab/health_checks/fs_shards_check.rb +++ b/lib/gitlab/health_checks/fs_shards_check.rb @@ -2,6 +2,9 @@ module Gitlab module HealthChecks class FsShardsCheck extend BaseAbstractCheck + RANDOM_STRING = SecureRandom.hex(1000).freeze + COMMAND_TIMEOUT = '1'.freeze + TIMEOUT_EXECUTABLE = 'timeout'.freeze class << self def readiness @@ -41,9 +44,6 @@ module Gitlab private - RANDOM_STRING = SecureRandom.hex(1000).freeze - COMMAND_TIMEOUT = 1.second - def operation_metrics(ok_metric, latency_metric, operation, **labels) with_timing operation do |result, elapsed| [ @@ -64,12 +64,8 @@ module Gitlab @storage_paths ||= Gitlab.config.repositories.storages end - def with_timeout(args) - %W{timeout #{COMMAND_TIMEOUT.to_i}}.concat(args) - end - def exec_with_timeout(cmd_args, *args, &block) - Gitlab::Popen.popen(with_timeout(cmd_args), *args, &block) + Gitlab::Popen.popen([TIMEOUT_EXECUTABLE, COMMAND_TIMEOUT].concat(cmd_args), *args, &block) end def tmp_file_path(storage_name) |