summaryrefslogtreecommitdiff
path: root/lib/gitlab/lfs_token.rb
diff options
context:
space:
mode:
authorPaul Charlton <techguru@byiq.com>2017-07-11 03:35:47 +0000
committerRobert Speicher <robert@gitlab.com>2017-07-11 03:35:47 +0000
commitcb3b4a15e6913bc28ee2ecaab017a4c3f08c438e (patch)
treedc3915aa94508d76df2480a8e26ec4b33797a320 /lib/gitlab/lfs_token.rb
parent4daa6da5407d235cbe4f7a787eaa29304446a870 (diff)
downloadgitlab-ce-cb3b4a15e6913bc28ee2ecaab017a4c3f08c438e.tar.gz
Support multiple Redis instances based on queue type
Diffstat (limited to 'lib/gitlab/lfs_token.rb')
-rw-r--r--lib/gitlab/lfs_token.rb8
1 files changed, 4 insertions, 4 deletions
diff --git a/lib/gitlab/lfs_token.rb b/lib/gitlab/lfs_token.rb
index 5f67e97fa2a..8e57ba831c5 100644
--- a/lib/gitlab/lfs_token.rb
+++ b/lib/gitlab/lfs_token.rb
@@ -18,10 +18,10 @@ module Gitlab
end
def token
- Gitlab::Redis.with do |redis|
- token = redis.get(redis_key)
+ Gitlab::Redis::SharedState.with do |redis|
+ token = redis.get(redis_shared_state_key)
token ||= Devise.friendly_token(TOKEN_LENGTH)
- redis.set(redis_key, token, ex: EXPIRY_TIME)
+ redis.set(redis_shared_state_key, token, ex: EXPIRY_TIME)
token
end
@@ -41,7 +41,7 @@ module Gitlab
private
- def redis_key
+ def redis_shared_state_key
"gitlab:lfs_token:#{actor.class.name.underscore}_#{actor.id}" if actor
end
end