diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-01-20 12:16:11 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-01-20 12:16:11 +0300 |
commit | edaa33dee2ff2f7ea3fac488d41558eb5f86d68c (patch) | |
tree | 11f143effbfeba52329fb7afbd05e6e2a3790241 /app/models/active_session.rb | |
parent | d8a5691316400a0f7ec4f83832698f1988eb27c1 (diff) |
Add latest changes from gitlab-org/gitlab@14-7-stable-eev14.7.0-rc42
Diffstat (limited to 'app/models/active_session.rb')
-rw-r--r-- | app/models/active_session.rb | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/app/models/active_session.rb b/app/models/active_session.rb index 0094d98fb73..9f634e70ff4 100644 --- a/app/models/active_session.rb +++ b/app/models/active_session.rb @@ -21,7 +21,6 @@ # class ActiveSession include ActiveModel::Model - include ::Gitlab::Redis::SessionsStoreHelper SESSION_BATCH_SIZE = 200 ALLOWED_NUMBER_OF_ACTIVE_SESSIONS = 100 @@ -66,7 +65,7 @@ class ActiveSession end def self.set(user, request) - redis_store_class.with do |redis| + Gitlab::Redis::Sessions.with do |redis| session_private_id = request.session.id.private_id client = DeviceDetector.new(request.user_agent) timestamp = Time.current @@ -107,7 +106,7 @@ class ActiveSession end def self.list(user) - redis_store_class.with do |redis| + Gitlab::Redis::Sessions.with do |redis| cleaned_up_lookup_entries(redis, user).map do |raw_session| load_raw_session(raw_session) end @@ -115,7 +114,7 @@ class ActiveSession end def self.cleanup(user) - redis_store_class.with do |redis| + Gitlab::Redis::Sessions.with do |redis| clean_up_old_sessions(redis, user) cleaned_up_lookup_entries(redis, user) end @@ -138,7 +137,7 @@ class ActiveSession def self.destroy_session(user, session_id) return unless session_id - redis_store_class.with do |redis| + Gitlab::Redis::Sessions.with do |redis| destroy_sessions(redis, user, [session_id].compact) end end @@ -147,7 +146,7 @@ class ActiveSession sessions = not_impersonated(user) sessions.reject! { |session| session.current?(current_rack_session) } if current_rack_session - redis_store_class.with do |redis| + Gitlab::Redis::Sessions.with do |redis| session_ids = sessions.flat_map(&:ids) destroy_sessions(redis, user, session_ids) if session_ids.any? end @@ -182,7 +181,7 @@ class ActiveSession # # Returns an array of strings def self.session_ids_for_user(user_id) - redis_store_class.with do |redis| + Gitlab::Redis::Sessions.with do |redis| redis.smembers(lookup_key_name(user_id)) end end @@ -195,7 +194,7 @@ class ActiveSession def self.sessions_from_ids(session_ids) return [] if session_ids.empty? - redis_store_class.with do |redis| + Gitlab::Redis::Sessions.with do |redis| session_keys = rack_session_keys(session_ids) session_keys.each_slice(SESSION_BATCH_SIZE).flat_map do |session_keys_batch| |