Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'app/models/active_session.rb')
-rw-r--r--app/models/active_session.rb5
1 files changed, 3 insertions, 2 deletions
diff --git a/app/models/active_session.rb b/app/models/active_session.rb
index a6d5fc1137d..3ecc3137157 100644
--- a/app/models/active_session.rb
+++ b/app/models/active_session.rb
@@ -146,8 +146,9 @@ class ActiveSession
# remove sessions if there are more than ALLOWED_NUMBER_OF_ACTIVE_SESSIONS.
sessions = active_session_entries(session_ids, user.id, redis)
sessions.sort_by! {|session| session.updated_at }.reverse!
- sessions = sessions[ALLOWED_NUMBER_OF_ACTIVE_SESSIONS..-1].map { |session| session.session_id }
- destroy_sessions(redis, user, sessions)
+ sessions = sessions.drop(ALLOWED_NUMBER_OF_ACTIVE_SESSIONS)
+ sessions = sessions.map { |session| session.session_id }
+ destroy_sessions(redis, user, sessions) if sessions.any?
end
def self.cleaned_up_lookup_entries(redis, user)