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:
authorToon Claes <toon@gitlab.com>2018-06-27 22:02:32 +0300
committerToon Claes <toon@gitlab.com>2018-06-27 22:43:23 +0300
commitf40f0c3067f655e845319c6860cd2b038c4490bd (patch)
tree752e088f13cd5ebcc104d070c0d0b4bcc5b802ab /app/workers/concerns/each_shard_worker.rb
parent041a8ae268f8c611f376715897bb965d7a6062a7 (diff)
Refactor fetching healthy shards with Gitlab::HealthChecks::GitalyCheck
There is only 1 `HEALTHY_SHARD_CHECKS` used: Gitlab::HealthChecks::GitalyCheck So we can simplify code to get the list of healthy shard names.
Diffstat (limited to 'app/workers/concerns/each_shard_worker.rb')
-rw-r--r--app/workers/concerns/each_shard_worker.rb13
1 files changed, 3 insertions, 10 deletions
diff --git a/app/workers/concerns/each_shard_worker.rb b/app/workers/concerns/each_shard_worker.rb
index 202b5759ee9..d0a728fb495 100644
--- a/app/workers/concerns/each_shard_worker.rb
+++ b/app/workers/concerns/each_shard_worker.rb
@@ -2,10 +2,6 @@ module EachShardWorker
extend ActiveSupport::Concern
include ::Gitlab::Utils::StrongMemoize
- HEALTHY_SHARD_CHECKS = [
- Gitlab::HealthChecks::GitalyCheck
- ].freeze
-
def each_eligible_shard
Gitlab::ShardHealthCache.update(eligible_shard_names)
@@ -21,18 +17,15 @@ module EachShardWorker
def healthy_shard_names
strong_memoize(:healthy_shard_names) do
- # For now, we need to perform both Gitaly and direct filesystem checks to ensure
- # the shard is healthy. We take the intersection of the successful checks
- # as the healthy shards.
- healthy_ready_shards.map { |result| result.labels[:shard] }.compact.uniq
+ healthy_ready_shards.map { |result| result.labels[:shard] }
end
end
def healthy_ready_shards
- ready_shards.map { |result| result.select(&:success) }.inject(:&)
+ ready_shards.select(&:success)
end
def ready_shards
- HEALTHY_SHARD_CHECKS.map(&:readiness)
+ Gitlab::HealthChecks::GitalyCheck.readiness
end
end