summaryrefslogtreecommitdiff
path: root/lib/gitlab
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2023-05-11 15:08:39 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2023-05-11 15:08:39 +0000
commit4564f677f8d71e814e89618e81709c86cf50e3d2 (patch)
tree9ba8fffbd8b3ec3d40dc12bfc4132d842f789cfc /lib/gitlab
parent0b54f87a31c23544ca5917bf772ce9c64a61562c (diff)
downloadgitlab-ce-4564f677f8d71e814e89618e81709c86cf50e3d2.tar.gz
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'lib/gitlab')
-rw-r--r--lib/gitlab/database/load_balancing/service_discovery.rb9
-rw-r--r--lib/gitlab/sidekiq_middleware/duplicate_jobs/duplicate_job.rb20
2 files changed, 9 insertions, 20 deletions
diff --git a/lib/gitlab/database/load_balancing/service_discovery.rb b/lib/gitlab/database/load_balancing/service_discovery.rb
index 5059b3b5c93..57a588db8a8 100644
--- a/lib/gitlab/database/load_balancing/service_discovery.rb
+++ b/lib/gitlab/database/load_balancing/service_discovery.rb
@@ -103,6 +103,15 @@ module Gitlab
# Slightly randomize the retry delay so that, in the case of a total
# dns outage, all starting services do not pressure the dns server at the same time.
sleep(rand(RETRY_DELAY_RANGE))
+ rescue Exception => error # rubocop:disable Lint/RescueException
+ # All exceptions are logged to find any pattern and solve https://gitlab.com/gitlab-org/gitlab/-/issues/364370
+ # This will be removed in https://gitlab.com/gitlab-org/gitlab/-/merge_requests/120173
+ Gitlab::Database::LoadBalancing::Logger.error(
+ event: :service_discovery_unexpected_exception,
+ message: "Service discovery encountered an uncaught error: #{error.message}"
+ )
+
+ raise
end
interval
diff --git a/lib/gitlab/sidekiq_middleware/duplicate_jobs/duplicate_job.rb b/lib/gitlab/sidekiq_middleware/duplicate_jobs/duplicate_job.rb
index 2ca8cca363c..bb87104630c 100644
--- a/lib/gitlab/sidekiq_middleware/duplicate_jobs/duplicate_job.rb
+++ b/lib/gitlab/sidekiq_middleware/duplicate_jobs/duplicate_job.rb
@@ -159,8 +159,6 @@ module Gitlab
end
def options
- # Remove line below when FF `ci_pipeline_process_worker_dedup_until_executed` is removed
- return job_deduplication[:options] if job_deduplication[:options]
return {} unless worker_klass
return {} unless worker_klass.respond_to?(:get_deduplication_options)
@@ -202,8 +200,6 @@ module Gitlab
end
def strategy
- # Remove line below when FF `ci_pipeline_process_worker_dedup_until_executed` is removed
- return job_deduplication[:strategy] if job_deduplication[:strategy]
return DEFAULT_STRATEGY unless worker_klass
return DEFAULT_STRATEGY unless worker_klass.respond_to?(:idempotent?)
return STRATEGY_NONE unless worker_klass.deduplication_enabled?
@@ -211,22 +207,6 @@ module Gitlab
worker_klass.get_deduplicate_strategy
end
- # Returns the deduplicate settings stored in the job itself; remove this method
- # when FF `ci_pipeline_process_worker_dedup_until_executed` is removed
- def job_deduplication
- return {} unless job['deduplicate']
-
- # Sometimes this setting is returned with all string keys/values; we need
- # to ensure the keys and values of the hash are fully symbolized or numeric
- job['deduplicate'].deep_symbolize_keys.tap do |hash|
- hash[:strategy] = hash[:strategy]&.to_sym
- hash[:options]&.each do |k, v|
- hash[:options][k] = k == :ttl ? v.to_i : v.to_sym
- end
- end.compact
- end
- strong_memoize_attr :job_deduplication
-
def worker_class_name
job['class']
end