Commit f3d635d3 authored by Sean McGivern's avatar Sean McGivern

Merge branch 'master' into 'master'

Log name of class that failed to obtain exclusive lease

See merge request gitlab-org/gitlab!35228
parents 7db702fd b5f971bc
...@@ -21,7 +21,7 @@ module ExclusiveLeaseGuard ...@@ -21,7 +21,7 @@ module ExclusiveLeaseGuard
lease = exclusive_lease.try_obtain lease = exclusive_lease.try_obtain
unless lease unless lease
log_error('Cannot obtain an exclusive lease. There must be another instance already in execution.') log_error("Cannot obtain an exclusive lease for #{self.class.name}. There must be another instance already in execution.")
return return
end end
......
---
title: Log name of class that failed to obtain exclusive lease
merge_request: 35228
author:
type: added
...@@ -51,7 +51,7 @@ RSpec.describe ExclusiveLeaseGuard, :clean_gitlab_redis_shared_state do ...@@ -51,7 +51,7 @@ RSpec.describe ExclusiveLeaseGuard, :clean_gitlab_redis_shared_state do
it 'does not call internal_method but logs error', :aggregate_failures do it 'does not call internal_method but logs error', :aggregate_failures do
expect(subject).not_to receive(:internal_method) expect(subject).not_to receive(:internal_method)
expect(Gitlab::AppLogger).to receive(:error).with('Cannot obtain an exclusive lease. There must be another instance already in execution.') expect(Gitlab::AppLogger).to receive(:error).with("Cannot obtain an exclusive lease for #{subject.class.name}. There must be another instance already in execution.")
subject.call subject.call
end end
......
...@@ -139,7 +139,7 @@ RSpec.describe Projects::GitDeduplicationService do ...@@ -139,7 +139,7 @@ RSpec.describe Projects::GitDeduplicationService do
end end
it 'fails when a lease is already out' do it 'fails when a lease is already out' do
expect(service).to receive(:log_error).with('Cannot obtain an exclusive lease. There must be another instance already in execution.') expect(service).to receive(:log_error).with("Cannot obtain an exclusive lease for #{service.class.name}. There must be another instance already in execution.")
service.execute service.execute
end end
......
...@@ -32,7 +32,7 @@ RSpec.describe RepositoryRemoveRemoteWorker do ...@@ -32,7 +32,7 @@ RSpec.describe RepositoryRemoveRemoteWorker do
expect(subject) expect(subject)
.to receive(:log_error) .to receive(:log_error)
.with('Cannot obtain an exclusive lease. There must be another instance already in execution.') .with("Cannot obtain an exclusive lease for #{subject.class.name}. There must be another instance already in execution.")
subject.perform(project.id, remote_name) subject.perform(project.id, remote_name)
end end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment