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>2023-09-13 06:11:37 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2023-09-13 06:11:37 +0300
commit9d7001c66ec5cd4e3d360f91486f32a2ede294df (patch)
tree6f31cc4059c3371a83a2d6d1ce3b470a294c01c7
parentec808a3c7020a1f487499314fc4d9942ea188ec4 (diff)
Add latest changes from gitlab-org/gitlab@master
-rw-r--r--app/services/members/destroy_service.rb4
-rw-r--r--config/initializers/sidekiq.rb2
-rw-r--r--doc/user/project/repository/code_suggestions/saas.md2
-rw-r--r--gems/activerecord-gitlab/lib/active_record/gitlab_patches/rescue_from.rb6
-rw-r--r--gems/activerecord-gitlab/spec/active_record/gitlab_patches/rescue_from_spec.rb26
-rw-r--r--lib/gitlab/patch/sidekiq_scheduled_enq.rb2
-rw-r--r--spec/lib/gitlab/patch/sidekiq_scheduled_enq_spec.rb18
7 files changed, 32 insertions, 28 deletions
diff --git a/app/services/members/destroy_service.rb b/app/services/members/destroy_service.rb
index e432016795d..d4cc60c6de0 100644
--- a/app/services/members/destroy_service.rb
+++ b/app/services/members/destroy_service.rb
@@ -47,6 +47,10 @@ module Members
def enqueue_jobs_that_needs_to_be_run_only_once_per_hierarchy(member, unassign_issuables)
return if recursive_call?
+ enqueue_cleanup_jobs_once_per_heirarchy(member, unassign_issuables)
+ end
+
+ def enqueue_cleanup_jobs_once_per_heirarchy(member, unassign_issuables)
enqueue_delete_todos(member)
enqueue_unassign_issuables(member) if unassign_issuables
end
diff --git a/config/initializers/sidekiq.rb b/config/initializers/sidekiq.rb
index dea4ed6b160..57850e4e35c 100644
--- a/config/initializers/sidekiq.rb
+++ b/config/initializers/sidekiq.rb
@@ -89,7 +89,7 @@ Sidekiq.configure_server do |config|
end
if enable_reliable_fetch?
- if Gitlab::Utils.to_boolean(ENV['SIDEKIQ_POLL_NON_NAMESPACED'])
+ if Gitlab::Utils.to_boolean(ENV['SIDEKIQ_ENABLE_DUAL_NAMESPACE_POLLING'], default: true)
# set non-namespaced store for fetcher to poll both namespaced and non-namespaced queues
config[:alternative_store] = ::Gitlab::Redis::Queues
config[:namespace] = Gitlab::Redis::Queues::SIDEKIQ_NAMESPACE
diff --git a/doc/user/project/repository/code_suggestions/saas.md b/doc/user/project/repository/code_suggestions/saas.md
index 1eea8dde6ed..4c44034646d 100644
--- a/doc/user/project/repository/code_suggestions/saas.md
+++ b/doc/user/project/repository/code_suggestions/saas.md
@@ -5,7 +5,7 @@ info: To determine the technical writer assigned to the Stage/Group associated w
type: index, reference
---
-# Code Suggestions on GitLab SaaS (Beta) **(FREE SAAS)**
+# Code Suggestions on GitLab SaaS **(FREE SAAS BETA)**
> - [Introduced](https://about.gitlab.com/releases/2023/02/22/gitlab-15-9-released/#code-suggestions-available-in-closed-beta) in GitLab 15.9 as [Beta](../../../../policy/experiment-beta-support.md#beta) for early access Ultimate customers on GitLab.com.
> - [Enabled](https://gitlab.com/gitlab-org/gitlab/-/issues/408104) as opt-in with GitLab 15.11 as [Beta](../../../../policy/experiment-beta-support.md#beta).
diff --git a/gems/activerecord-gitlab/lib/active_record/gitlab_patches/rescue_from.rb b/gems/activerecord-gitlab/lib/active_record/gitlab_patches/rescue_from.rb
index eaa42d1523d..faabddd2686 100644
--- a/gems/activerecord-gitlab/lib/active_record/gitlab_patches/rescue_from.rb
+++ b/gems/activerecord-gitlab/lib/active_record/gitlab_patches/rescue_from.rb
@@ -3,8 +3,10 @@
module ActiveRecord
module GitlabPatches
# This adds `rescue_from` to ActiveRecord::Base.
- # Currently, only errors called from `ActiveRecord::Relation#exec_queries`
- # will be handled by `rescue_from`.
+ # Currently only the following places will be handled by `rescue_from`:
+ #
+ # - `ActiveRecord::Relation#load`, and other methods that call
+ # `ActiveRecord::Relation#exec_queries`.
#
# class ApplicationRecord < ActiveRecord::Base
# rescue_from MyException, with: :my_handler
diff --git a/gems/activerecord-gitlab/spec/active_record/gitlab_patches/rescue_from_spec.rb b/gems/activerecord-gitlab/spec/active_record/gitlab_patches/rescue_from_spec.rb
index c1537c3bd90..22729edb014 100644
--- a/gems/activerecord-gitlab/spec/active_record/gitlab_patches/rescue_from_spec.rb
+++ b/gems/activerecord-gitlab/spec/active_record/gitlab_patches/rescue_from_spec.rb
@@ -1,9 +1,9 @@
# frozen_string_literal: true
-RSpec.describe ActiveRecord::GitlabPatches::RescueFrom, :without_sqlite3 do
+RSpec.describe ActiveRecord::GitlabPatches::RescueFrom do
let(:model_with_rescue_from) do
- Class.new(ActiveRecord::Base) do
- rescue_from ActiveRecord::ConnectionNotEstablished, with: :handle_exception
+ Class.new(Project) do
+ rescue_from ActiveRecord::StatementInvalid, with: :handle_exception
class << self
def handle_exception(exception); end
@@ -12,20 +12,18 @@ RSpec.describe ActiveRecord::GitlabPatches::RescueFrom, :without_sqlite3 do
end
let(:model_without_rescue_from) do
- Class.new(ActiveRecord::Base)
+ Class.new(Project)
end
- it 'triggers rescue_from' do
- stub_const('ModelWithRescueFrom', model_with_rescue_from)
+ context 'for errors from ActiveRelation.load' do
+ it 'triggers rescue_from' do
+ expect(model_with_rescue_from).to receive(:handle_exception)
- expect(model_with_rescue_from).to receive(:handle_exception)
-
- expect { model_with_rescue_from.all.load }.not_to raise_error
- end
-
- it 'does not trigger rescue_from' do
- stub_const('ModelWithoutRescueFrom', model_without_rescue_from)
+ expect { model_with_rescue_from.where('BADQUERY').load }.not_to raise_error
+ end
- expect { model_without_rescue_from.all.load }.to raise_error(ActiveRecord::ConnectionNotEstablished)
+ it 'does not trigger rescue_from' do
+ expect { model_without_rescue_from.where('BADQUERY').load }.to raise_error(ActiveRecord::StatementInvalid)
+ end
end
end
diff --git a/lib/gitlab/patch/sidekiq_scheduled_enq.rb b/lib/gitlab/patch/sidekiq_scheduled_enq.rb
index ed269b115dc..de0e8465f97 100644
--- a/lib/gitlab/patch/sidekiq_scheduled_enq.rb
+++ b/lib/gitlab/patch/sidekiq_scheduled_enq.rb
@@ -10,7 +10,7 @@ module Gitlab
# namespaced sets via super and vice-versa depending on how Sidekiq.redis was configured
def enqueue_jobs(sorted_sets = Sidekiq::Scheduled::SETS)
# checks the other namespace
- if Gitlab::Utils.to_boolean(ENV['SIDEKIQ_POLL_NON_NAMESPACED'])
+ if Gitlab::Utils.to_boolean(ENV['SIDEKIQ_ENABLE_DUAL_NAMESPACE_POLLING'], default: true)
# Refer to https://github.com/sidekiq/sidekiq/blob/v6.5.7/lib/sidekiq/scheduled.rb#L25
# this portion swaps out Sidekiq.redis for Gitlab::Redis::Queues
Gitlab::Redis::Queues.with do |conn| # rubocop:disable Cop/RedisQueueUsage
diff --git a/spec/lib/gitlab/patch/sidekiq_scheduled_enq_spec.rb b/spec/lib/gitlab/patch/sidekiq_scheduled_enq_spec.rb
index 43c4a7a3e71..f57257cd1c0 100644
--- a/spec/lib/gitlab/patch/sidekiq_scheduled_enq_spec.rb
+++ b/spec/lib/gitlab/patch/sidekiq_scheduled_enq_spec.rb
@@ -16,8 +16,8 @@ RSpec.describe Gitlab::Patch::SidekiqScheduledEnq, :clean_gitlab_redis_queues, f
subject { Sidekiq::Scheduled::Enq.new.enqueue_jobs }
- it 'only polls with Sidekiq.redis' do
- expect(Sidekiq::Client).to receive(:push).with(payload).once
+ it 'polls both namespaces by default' do
+ expect(Sidekiq::Client).to receive(:push).with(payload).twice
subject
@@ -26,17 +26,17 @@ RSpec.describe Gitlab::Patch::SidekiqScheduledEnq, :clean_gitlab_redis_queues, f
end
Gitlab::Redis::Queues.with do |conn|
- expect(conn.zcard('schedule')).to eq(1)
+ expect(conn.zcard('schedule')).to eq(0)
end
end
- context 'when SIDEKIQ_POLL_NON_NAMESPACED is enabled' do
+ context 'when SIDEKIQ_ENABLE_DUAL_NAMESPACE_POLLING is disabled' do
before do
- stub_env('SIDEKIQ_POLL_NON_NAMESPACED', 'true')
+ stub_env('SIDEKIQ_ENABLE_DUAL_NAMESPACE_POLLING', 'false')
end
- it 'polls both sets' do
- expect(Sidekiq::Client).to receive(:push).with(payload).twice
+ it 'polls via Sidekiq.redis only' do
+ expect(Sidekiq::Client).to receive(:push).with(payload).once
subject
@@ -45,7 +45,7 @@ RSpec.describe Gitlab::Patch::SidekiqScheduledEnq, :clean_gitlab_redis_queues, f
end
Gitlab::Redis::Queues.with do |conn|
- expect(conn.zcard('schedule')).to eq(0)
+ expect(conn.zcard('schedule')).to eq(1)
end
end
end
@@ -68,7 +68,7 @@ RSpec.describe Gitlab::Patch::SidekiqScheduledEnq, :clean_gitlab_redis_queues, f
before do
stub_env('SIDEKIQ_ENQUEUE_NON_NAMESPACED', 'true')
- stub_env('SIDEKIQ_POLL_NON_NAMESPACED', 'true')
+ stub_env('SIDEKIQ_ENABLE_DUAL_NAMESPACE_POLLING', 'true')
end
it 'polls both sets' do