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
0
Merge Requests
0
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
iv
gitlab-ce
Commits
3729c082
Commit
3729c082
authored
Mar 10, 2016
by
Jacob Vosmaer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove unnecessary random key
parent
66d5d922
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
1 addition
and
7 deletions
+1
-7
lib/gitlab/exclusive_lease.rb
lib/gitlab/exclusive_lease.rb
+1
-7
No files found.
lib/gitlab/exclusive_lease.rb
View file @
3729c082
require
'securerandom'
module
Gitlab
# This class implements an 'exclusive lease'. We call it a 'lease'
# because it has a set expiry time. We call it 'exclusive' because only
...
...
@@ -27,7 +25,7 @@ module Gitlab
def
try_obtain
# This is expected to be atomic because we are talking to a
# single-threaded Redis server.
!!
redis
.
set
(
redis_key
,
redis_value
,
nx:
true
,
ex:
@timeout
)
!!
redis
.
set
(
redis_key
,
'1'
,
nx:
true
,
ex:
@timeout
)
end
private
...
...
@@ -40,9 +38,5 @@ module Gitlab
def
redis_key
"gitlab:exclusive_lease:
#{
@key
}
"
end
def
redis_value
@redis_value
||=
SecureRandom
.
hex
(
10
)
end
end
end
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