Make Geo::BaseSyncService#lease_key public

parent ba96f077
...@@ -21,6 +21,10 @@ module Geo ...@@ -21,6 +21,10 @@ module Geo
end end
end end
def lease_key
@lease_key ||= "#{LEASE_KEY_PREFIX}:#{type}:#{project.id}"
end
private private
def registry def registry
...@@ -64,10 +68,6 @@ module Geo ...@@ -64,10 +68,6 @@ module Geo
registry.update!(attrs) registry.update!(attrs)
end end
def lease_key
@lease_key ||= "#{LEASE_KEY_PREFIX}:#{type}:#{project.id}"
end
def type def type
self.class.type self.class.type
end end
......
...@@ -8,7 +8,7 @@ RSpec.describe Geo::RepositorySyncService, services: true do ...@@ -8,7 +8,7 @@ RSpec.describe Geo::RepositorySyncService, services: true do
before do before do
allow(Gitlab::ExclusiveLease).to receive(:new) allow(Gitlab::ExclusiveLease).to receive(:new)
.with(subject.__send__(:lease_key), anything) .with(subject.lease_key, anything)
.and_return(lease) .and_return(lease)
allow_any_instance_of(Repository).to receive(:fetch_geo_mirror) allow_any_instance_of(Repository).to receive(:fetch_geo_mirror)
......
...@@ -8,7 +8,7 @@ RSpec.describe Geo::WikiSyncService, services: true do ...@@ -8,7 +8,7 @@ RSpec.describe Geo::WikiSyncService, services: true do
before do before do
allow(Gitlab::ExclusiveLease).to receive(:new) allow(Gitlab::ExclusiveLease).to receive(:new)
.with(subject.__send__(:lease_key), anything) .with(subject.lease_key, anything)
.and_return(lease) .and_return(lease)
allow_any_instance_of(Repository).to receive(:fetch_geo_mirror) allow_any_instance_of(Repository).to receive(:fetch_geo_mirror)
......
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