Skip to content
Snippets Groups Projects
Commit 97791a30 authored by feistel's avatar feistel
Browse files

Remove RepositoryRemoveRemoteWorker and queues

RepositoryRemoveRemoteWorker's logic has been removed in 14.2 but
the worker itself needs to stay until 15.0 to drain the job queue.
It can be removed now.
parent 97a5cc89
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -2983,15 +2983,6 @@
:weight: 1
:idempotent:
:tags: []
- :name: repository_remove_remote
:worker_name: RepositoryRemoveRemoteWorker
:feature_category: :source_code_management
:has_external_dependencies:
:urgency: :low
:resource_boundary: :unknown
:weight: 1
:idempotent:
:tags: []
- :name: repository_update_remote_mirror
:worker_name: RepositoryUpdateRemoteMirrorWorker
:feature_category: :source_code_management
Loading
Loading
# frozen_string_literal: true
class RepositoryRemoveRemoteWorker # rubocop:disable Scalability/IdempotentWorker
include ApplicationWorker
data_consistency :always
sidekiq_options retry: 3
include ExclusiveLeaseGuard
feature_category :source_code_management
loggable_arguments 1
LEASE_TIMEOUT = 1.hour
attr_reader :project, :remote_name
def perform(project_id, remote_name)
# On-disk remotes are slated for removal, and GitLab doesn't create any of
# them anymore. For backwards compatibility, we need to keep the worker
# though such that we can be sure to drain all jobs on an update. Making
# this a no-op is fine though: the worst that can happen is that we still
# have old remotes lingering in the repository's config, but Gitaly will
# start to clean these up in repository maintenance.
# https://gitlab.com/gitlab-org/gitlab/-/issues/336745
end
def lease_timeout
LEASE_TIMEOUT
end
def lease_key
"remove_remote_#{project.id}_#{remote_name}"
end
end
Loading
Loading
@@ -405,8 +405,6 @@
- 1
- - repository_push_audit_event
- 1
- - repository_remove_remote
- 1
- - repository_update_mirror
- 1
- - repository_update_remote_mirror
Loading
Loading
Loading
Loading
@@ -1243,8 +1243,6 @@
it 'removes previous remote' do
project = create(:project, :repository, :mirror)
 
expect(RepositoryRemoveRemoteWorker).not_to receive(:perform_async)
project.update!(import_url: "http://test.com")
end
end
Loading
Loading
Loading
Loading
@@ -254,8 +254,6 @@
it 'does not remove the remote' do
mirror = create_mirror(url: 'http://foo:bar@test.com')
 
expect(RepositoryRemoveRemoteWorker).not_to receive(:perform_async)
mirror.destroy!
end
end
Loading
Loading
Loading
Loading
@@ -410,7 +410,6 @@
'RepositoryCleanupWorker' => 3,
'RepositoryForkWorker' => 5,
'RepositoryImportWorker' => false,
'RepositoryRemoveRemoteWorker' => 3,
'RepositoryUpdateMirrorWorker' => false,
'RepositoryPushAuditEventWorker' => 3,
'RepositoryUpdateRemoteMirrorWorker' => 3,
Loading
Loading
# frozen_string_literal: true
require 'spec_helper'
RSpec.describe RepositoryRemoveRemoteWorker do
include ExclusiveLeaseHelpers
include GitHelpers
describe '#perform' do
let!(:project) { create(:project, :repository) }
let(:remote_name) { 'joe'}
let(:lease_key) { "remove_remote_#{project.id}_#{remote_name}" }
let(:lease_timeout) { RepositoryRemoveRemoteWorker::LEASE_TIMEOUT }
it 'returns nil when project does not exist' do
expect(subject.perform(-1, 'remote_name')).to be_nil
end
context 'when project exists' do
before do
allow(Project)
.to receive(:find_by)
.with(id: project.id)
.and_return(project)
end
it 'does nothing when cannot obtain lease' do
stub_exclusive_lease_taken(lease_key, timeout: lease_timeout)
expect(project.repository)
.not_to receive(:remove_remote)
expect(subject)
.not_to receive(:log_error)
subject.perform(project.id, remote_name)
end
it 'does nothing when obtain a lease' do
stub_exclusive_lease(lease_key, timeout: lease_timeout)
expect(project.repository)
.not_to receive(:remove_remote)
subject.perform(project.id, remote_name)
end
end
end
end
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment