Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
ad2d0041
Commit
ad2d0041
authored
May 07, 2018
by
Gabriel Mazetto
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use `!` for `increment_syncs_since_gc` and `reset_syncs_since_gc`
parent
387c844e
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
10 additions
and
10 deletions
+10
-10
ee/app/models/geo/project_registry.rb
ee/app/models/geo/project_registry.rb
+2
-2
ee/app/services/geo/project_housekeeping_service.rb
ee/app/services/geo/project_housekeeping_service.rb
+2
-2
ee/spec/models/geo/project_registry_spec.rb
ee/spec/models/geo/project_registry_spec.rb
+4
-4
ee/spec/services/geo/project_housekeeping_service_spec.rb
ee/spec/services/geo/project_housekeeping_service_spec.rb
+2
-2
No files found.
ee/app/models/geo/project_registry.rb
View file @
ad2d0041
...
@@ -64,11 +64,11 @@ class Geo::ProjectRegistry < Geo::BaseRegistry
...
@@ -64,11 +64,11 @@ class Geo::ProjectRegistry < Geo::BaseRegistry
Gitlab
::
Redis
::
SharedState
.
with
{
|
redis
|
redis
.
get
(
fetches_since_gc_redis_key
).
to_i
}
Gitlab
::
Redis
::
SharedState
.
with
{
|
redis
|
redis
.
get
(
fetches_since_gc_redis_key
).
to_i
}
end
end
def
increment_syncs_since_gc
def
increment_syncs_since_gc
!
Gitlab
::
Redis
::
SharedState
.
with
{
|
redis
|
redis
.
incr
(
fetches_since_gc_redis_key
)
}
Gitlab
::
Redis
::
SharedState
.
with
{
|
redis
|
redis
.
incr
(
fetches_since_gc_redis_key
)
}
end
end
def
reset_syncs_since_gc
def
reset_syncs_since_gc
!
Gitlab
::
Redis
::
SharedState
.
with
{
|
redis
|
redis
.
del
(
fetches_since_gc_redis_key
)
}
Gitlab
::
Redis
::
SharedState
.
with
{
|
redis
|
redis
.
del
(
fetches_since_gc_redis_key
)
}
end
end
...
...
ee/app/services/geo/project_housekeeping_service.rb
View file @
ad2d0041
...
@@ -29,7 +29,7 @@ module Geo
...
@@ -29,7 +29,7 @@ module Geo
def
increment!
def
increment!
Gitlab
::
Metrics
.
measure
(
:geo_increment_syncs_since_gc
)
do
Gitlab
::
Metrics
.
measure
(
:geo_increment_syncs_since_gc
)
do
registry
.
increment_syncs_since_gc
registry
.
increment_syncs_since_gc
!
end
end
end
end
...
@@ -47,7 +47,7 @@ module Geo
...
@@ -47,7 +47,7 @@ module Geo
ensure
ensure
if
should_reset?
if
should_reset?
Gitlab
::
Metrics
.
measure
(
:geo_reset_syncs_since_gc
)
do
Gitlab
::
Metrics
.
measure
(
:geo_reset_syncs_since_gc
)
do
registry
.
reset_syncs_since_gc
registry
.
reset_syncs_since_gc
!
end
end
end
end
end
end
...
...
ee/spec/models/geo/project_registry_spec.rb
View file @
ad2d0041
...
@@ -213,7 +213,7 @@ describe Geo::ProjectRegistry do
...
@@ -213,7 +213,7 @@ describe Geo::ProjectRegistry do
context
'redis shared state'
,
:redis
do
context
'redis shared state'
,
:redis
do
after
do
after
do
subject
.
reset_syncs_since_gc
subject
.
reset_syncs_since_gc
!
end
end
describe
'#syncs_since_gc'
do
describe
'#syncs_since_gc'
do
...
@@ -234,7 +234,7 @@ describe Geo::ProjectRegistry do
...
@@ -234,7 +234,7 @@ describe Geo::ProjectRegistry do
describe
'#increment_syncs_since_gc'
do
describe
'#increment_syncs_since_gc'
do
it
'increments the number of pushes since the last 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
)
expect
(
subject
.
syncs_since_gc
).
to
eq
(
3
)
end
end
...
@@ -242,9 +242,9 @@ describe Geo::ProjectRegistry do
...
@@ -242,9 +242,9 @@ describe Geo::ProjectRegistry do
describe
'#reset_syncs_since_gc'
do
describe
'#reset_syncs_since_gc'
do
it
'resets the number of pushes since the last 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
)
expect
(
subject
.
syncs_since_gc
).
to
eq
(
0
)
end
end
...
...
ee/spec/services/geo/project_housekeeping_service_spec.rb
View file @
ad2d0041
...
@@ -6,11 +6,11 @@ describe Geo::ProjectHousekeepingService do
...
@@ -6,11 +6,11 @@ describe Geo::ProjectHousekeepingService do
let
(
:registry
)
{
service
.
registry
}
let
(
:registry
)
{
service
.
registry
}
before
do
before
do
registry
.
reset_syncs_since_gc
registry
.
reset_syncs_since_gc
!
end
end
after
do
after
do
registry
.
reset_syncs_since_gc
registry
.
reset_syncs_since_gc
!
end
end
describe
'#execute'
do
describe
'#execute'
do
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment