Skip to content
Snippets Groups Projects
Commit 0c1eebe2 authored by Stan Hu's avatar Stan Hu
Browse files

Fix ArgumentError in GitGarbageCollectWorker Sidekiq job

When the Gitaly call failed, the exception handling failed
because `method` is expected to have a parameter.

Closes #49096
parent 255db3d5
No related branches found
No related tags found
1 merge request!10495Merge Requests - Assignee
Loading
Loading
@@ -65,10 +65,10 @@ class GitGarbageCollectWorker
client.repack_incremental
end
rescue GRPC::NotFound => e
Gitlab::GitLogger.error("#{method} failed:\nRepository not found")
Gitlab::GitLogger.error("#{__method__} failed:\nRepository not found")
raise Gitlab::Git::Repository::NoRepository.new(e)
rescue GRPC::BadStatus => e
Gitlab::GitLogger.error("#{method} failed:\n#{e}")
Gitlab::GitLogger.error("#{__method__} failed:\n#{e}")
raise Gitlab::Git::CommandError.new(e)
end
 
Loading
Loading
Loading
Loading
@@ -27,6 +27,12 @@ describe GitGarbageCollectWorker do
 
subject.perform(project.id, :gc, lease_key, lease_uuid)
end
it 'handles gRPC errors' do
expect_any_instance_of(Gitlab::GitalyClient::RepositoryService).to receive(:garbage_collect).and_raise(GRPC::NotFound)
expect { subject.perform(project.id, :gc, lease_key, lease_uuid) }.to raise_exception(Gitlab::Git::Repository::NoRepository)
end
end
 
context 'with different lease than the active one' do
Loading
Loading
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