Commit ad2d0041 authored by Gabriel Mazetto's avatar Gabriel Mazetto

Use `!` for `increment_syncs_since_gc` and `reset_syncs_since_gc`

parent 387c844e
......@@ -64,11 +64,11 @@ class Geo::ProjectRegistry < Geo::BaseRegistry
Gitlab::Redis::SharedState.with { |redis| redis.get(fetches_since_gc_redis_key).to_i }
end
def increment_syncs_since_gc
def increment_syncs_since_gc!
Gitlab::Redis::SharedState.with { |redis| redis.incr(fetches_since_gc_redis_key) }
end
def reset_syncs_since_gc
def reset_syncs_since_gc!
Gitlab::Redis::SharedState.with { |redis| redis.del(fetches_since_gc_redis_key) }
end
......
......@@ -29,7 +29,7 @@ module Geo
def increment!
Gitlab::Metrics.measure(:geo_increment_syncs_since_gc) do
registry.increment_syncs_since_gc
registry.increment_syncs_since_gc!
end
end
......@@ -47,7 +47,7 @@ module Geo
ensure
if should_reset?
Gitlab::Metrics.measure(:geo_reset_syncs_since_gc) do
registry.reset_syncs_since_gc
registry.reset_syncs_since_gc!
end
end
end
......
......@@ -213,7 +213,7 @@ describe Geo::ProjectRegistry do
context 'redis shared state', :redis do
after do
subject.reset_syncs_since_gc
subject.reset_syncs_since_gc!
end
describe '#syncs_since_gc' do
......@@ -234,7 +234,7 @@ describe Geo::ProjectRegistry do
describe '#increment_syncs_since_gc' do
it 'increments the number of pushes since the last GC' do
3.times { subject.increment_syncs_since_gc }
3.times { subject.increment_syncs_since_gc! }
expect(subject.syncs_since_gc).to eq(3)
end
......@@ -242,9 +242,9 @@ describe Geo::ProjectRegistry do
describe '#reset_syncs_since_gc' do
it 'resets the number of pushes since the last GC' do
3.times { subject.increment_syncs_since_gc }
3.times { subject.increment_syncs_since_gc! }
subject.reset_syncs_since_gc
subject.reset_syncs_since_gc!
expect(subject.syncs_since_gc).to eq(0)
end
......
......@@ -6,11 +6,11 @@ describe Geo::ProjectHousekeepingService do
let(:registry) { service.registry }
before do
registry.reset_syncs_since_gc
registry.reset_syncs_since_gc!
end
after do
registry.reset_syncs_since_gc
registry.reset_syncs_since_gc!
end
describe '#execute' do
......
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