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
2212dad6
Commit
2212dad6
authored
Sep 25, 2017
by
Toon Claes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Do not check for secondary? but use readonly? instead
See gitlab-org/gitlab-ee!2983.
parent
d1164bd7
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
4 additions
and
15 deletions
+4
-15
app/services/keys/last_used_service.rb
app/services/keys/last_used_service.rb
+2
-2
ee/app/services/ee/keys/last_used_service.rb
ee/app/services/ee/keys/last_used_service.rb
+0
-11
spec/ee/spec/services/ee/keys/last_used_service_spec.rb
spec/ee/spec/services/ee/keys/last_used_service_spec.rb
+2
-2
No files found.
app/services/keys/last_used_service.rb
View file @
2212dad6
module
Keys
class
LastUsedService
prepend
::
EE
::
Keys
::
LastUsedService
TIMEOUT
=
1
.
day
.
to_i
attr_reader
:key
...
...
@@ -18,6 +16,8 @@ module Keys
end
def
update?
return
false
if
::
Gitlab
::
Database
.
readonly?
last_used
=
key
.
last_used_at
return
false
if
last_used
&&
(
Time
.
zone
.
now
-
last_used
)
<=
TIMEOUT
...
...
ee/app/services/ee/keys/last_used_service.rb
deleted
100644 → 0
View file @
d1164bd7
module
EE
module
Keys
module
LastUsedService
def
update?
raise
NotImplementedError
unless
defined?
(
super
)
!::
Gitlab
::
Geo
.
secondary?
&&
super
end
end
end
end
spec/ee/spec/services/ee/keys/last_used_service_spec.rb
View file @
2212dad6
require
'spec_helper'
describe
Keys
::
LastUsedService
do
it
'does not run on
Geo secondari
es'
,
:clean_gitlab_redis_shared_state
do
it
'does not run on
read-only GitLab instanc
es'
,
:clean_gitlab_redis_shared_state
do
key
=
create
(
:key
,
last_used_at:
1
.
year
.
ago
)
original_time
=
key
.
last_used_at
allow
(
::
Gitlab
::
Geo
).
to
receive
(
:secondar
y?
).
and_return
(
true
)
allow
(
::
Gitlab
::
Database
).
to
receive
(
:readonl
y?
).
and_return
(
true
)
described_class
.
new
(
key
).
execute
expect
(
key
.
reload
.
last_used_at
).
to
be_like_time
(
original_time
)
...
...
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