diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-08-13 15:09:50 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-08-13 15:09:50 +0300 |
commit | 5605efec12c99adf88f641391cb879dedf8fa05e (patch) | |
tree | 4aea188ef160dec9346f0bcf61ecbe9cb7fa6661 /lib/gitlab | |
parent | 4e33606f0114c39e07f0151465299f75bfe00c3e (diff) |
Add latest changes from gitlab-org/gitlab@masterfix-master-merge-train-helper
Diffstat (limited to 'lib/gitlab')
-rw-r--r-- | lib/gitlab/ci/features.rb | 2 | ||||
-rw-r--r-- | lib/gitlab/usage_data/topology.rb | 16 |
2 files changed, 17 insertions, 1 deletions
diff --git a/lib/gitlab/ci/features.rb b/lib/gitlab/ci/features.rb index d4b3c58ec56..472f0f36231 100644 --- a/lib/gitlab/ci/features.rb +++ b/lib/gitlab/ci/features.rb @@ -77,7 +77,7 @@ module Gitlab end def self.lint_creates_pipeline_with_dry_run?(project) - ::Feature.enabled?(:ci_lint_creates_pipeline_with_dry_run, project) + ::Feature.enabled?(:ci_lint_creates_pipeline_with_dry_run, project, default_enabled: true) end def self.reset_ci_minutes_for_all_namespaces? diff --git a/lib/gitlab/usage_data/topology.rb b/lib/gitlab/usage_data/topology.rb index 960b8f74eb1..edc4dc75750 100644 --- a/lib/gitlab/usage_data/topology.rb +++ b/lib/gitlab/usage_data/topology.rb @@ -17,6 +17,9 @@ module Gitlab 'registry' => 'registry' }.freeze + # If these errors occur, all subsequent queries are likely to fail for the same error + TIMEOUT_ERRORS = [Errno::ETIMEDOUT, Net::OpenTimeout, Net::ReadTimeout].freeze + CollectionFailure = Struct.new(:query, :error) do def to_h { query => error } @@ -158,6 +161,11 @@ module Gitlab end def query_safely(query, query_name, fallback:) + if timeout_error_exists? + @failures << CollectionFailure.new(query_name, 'timeout_cancellation') + return fallback + end + result = yield query return result if result.present? @@ -169,6 +177,14 @@ module Gitlab fallback end + def timeout_error_exists? + timeout_error_names = TIMEOUT_ERRORS.map(&:to_s).to_set + + @failures.any? do |failure| + timeout_error_names.include?(failure.error) + end + end + def topology_node_services(instance, all_process_counts, all_process_memory, all_server_types) # returns all node service data grouped by service name as the key instance_service_data = |