diff options
author | Imre Farkas <ifarkas@gitlab.com> | 2019-07-12 15:25:12 +0300 |
---|---|---|
committer | Imre Farkas <ifarkas@gitlab.com> | 2019-07-22 18:15:57 +0300 |
commit | 313f145b5594ebba7ce4675905061144adb3b44a (patch) | |
tree | 33683a02092d00fd587832dd40f99c5452dd2454 /app/models | |
parent | c5fac1034f43d81a17242d8ade2d7eb8741a72e2 (diff) |
Rake task to cleanup expired ActiveSession lookup keys
In some cases ActiveSession.cleanup was not called after authentication,
so for some user ActiveSession lookup keys grew without ever cleaning
up. This Rake task manually iterates over the lookup keys and removes
ones without existing ActiveSession.
Diffstat (limited to 'app/models')
-rw-r--r-- | app/models/active_session.rb | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/app/models/active_session.rb b/app/models/active_session.rb index 345767179eb..fdd210f0fba 100644 --- a/app/models/active_session.rb +++ b/app/models/active_session.rb @@ -93,12 +93,12 @@ class ActiveSession end def self.list_sessions(user) - sessions_from_ids(session_ids_for_user(user)) + sessions_from_ids(session_ids_for_user(user.id)) end - def self.session_ids_for_user(user) + def self.session_ids_for_user(user_id) Gitlab::Redis::SharedState.with do |redis| - redis.smembers(lookup_key_name(user.id)) + redis.smembers(lookup_key_name(user_id)) end end @@ -129,7 +129,7 @@ class ActiveSession end def self.cleaned_up_lookup_entries(redis, user) - session_ids = session_ids_for_user(user) + session_ids = session_ids_for_user(user.id) entries = raw_active_session_entries(session_ids, user.id) # remove expired keys. |