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
a3f90e6f
Commit
a3f90e6f
authored
Aug 09, 2018
by
Nick Thomas
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Geo: Use database-cached status if redis-cached status is unavailable
parent
fefd66de
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
23 additions
and
7 deletions
+23
-7
ee/changelogs/unreleased/status-on-secondary.yml
ee/changelogs/unreleased/status-on-secondary.yml
+5
-0
ee/lib/api/geo_nodes.rb
ee/lib/api/geo_nodes.rb
+2
-5
ee/spec/requests/api/geo_nodes_spec.rb
ee/spec/requests/api/geo_nodes_spec.rb
+16
-2
No files found.
ee/changelogs/unreleased/status-on-secondary.yml
0 → 100644
View file @
a3f90e6f
---
title
:
'
Geo:
Use
database-cached
status
if
redis-cached
status
is
unavailable'
merge_request
:
6854
author
:
type
:
fixed
ee/lib/api/geo_nodes.rb
View file @
a3f90e6f
...
...
@@ -77,11 +77,8 @@ module API
def
geo_node_status
strong_memoize
(
:geo_node_status
)
do
if
geo_node
.
current?
GeoNodeStatus
.
fast_current_node_status
else
geo_node
.
status
end
status
=
GeoNodeStatus
.
fast_current_node_status
if
geo_node
.
current?
status
||
geo_node
.
status
end
end
end
...
...
ee/spec/requests/api/geo_nodes_spec.rb
View file @
a3f90e6f
...
...
@@ -89,7 +89,7 @@ describe API::GeoNodes, :geo, :prometheus, api: true do
expect
(
links
[
'node'
]).
to
end_with
(
"/api/v4/geo_nodes/
#{
secondary
.
id
}
"
)
end
it
'fetches the current node status'
do
it
'fetches the current node status
from redis
'
do
stub_current_geo_node
(
secondary
)
expect
(
GeoNodeStatus
).
to
receive
(
:fast_current_node_status
).
and_return
(
secondary_status
)
...
...
@@ -101,9 +101,23 @@ describe API::GeoNodes, :geo, :prometheus, api: true do
expect
(
response
).
to
match_response_schema
(
'public_api/v4/geo_node_status'
,
dir:
'ee'
)
end
it
'shows
404 response if current node status does not exist yet'
do
it
'shows
the database-held response if current node status exists in the database, but not redis'
do
stub_current_geo_node
(
secondary
)
expect
(
GeoNodeStatus
).
to
receive
(
:fast_current_node_status
).
and_return
(
nil
)
expect
(
GeoNode
).
to
receive
(
:find
).
and_return
(
secondary
)
get
api
(
"/geo_nodes/
#{
secondary
.
id
}
/status"
,
admin
)
expect
(
response
).
to
have_gitlab_http_status
(
200
)
expect
(
response
).
to
match_response_schema
(
'public_api/v4/geo_node_status'
,
dir:
'ee'
)
end
it
'shows 404 response if current node status does not exist in database or redis yet'
do
stub_current_geo_node
(
secondary
)
secondary_status
.
destroy!
expect
(
GeoNodeStatus
).
to
receive
(
:fast_current_node_status
).
and_return
(
nil
)
expect
(
GeoNode
).
to
receive
(
:find
).
and_return
(
secondary
)
get
api
(
"/geo_nodes/
#{
secondary
.
id
}
/status"
,
admin
)
...
...
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