diff --git a/Core/Sessions/Session.st b/Core/Sessions/Session.st index b24c4a0..08c942f 100644 --- a/Core/Sessions/Session.st +++ b/Core/Sessions/Session.st @@ -358,13 +358,6 @@ IliadObject subclass: Session [ includesKey: self sessionManager cookieName) not ] - removeYourself [ - - SessionManager current sessions - removeKey: self id asString - ifAbsent: [] - ] - addToDirtyWidgets: aWidget [ self dirtyWidgets add: aWidget diff --git a/Core/Sessions/SessionManager.st b/Core/Sessions/SessionManager.st index 108b831..3b6c524 100644 --- a/Core/Sessions/SessionManager.st +++ b/Core/Sessions/SessionManager.st @@ -91,6 +91,11 @@ To remove all expired sessions, call #removeExpiredSessions'> ^self preferenceAt: #actionKey ifAbsentPut: ['_action'] ] + tokenKey [ + + ^self preferenceAt: #tokenKey ifAbsentPut: ['_token'] + ] + cookieName [ ^self preferenceAt: #cookieName ifAbsentPut: ['_iliad685744'] @@ -131,11 +136,6 @@ To remove all expired sessions, call #removeExpiredSessions'> ^self preferences at: #sessionClass put: aSessionClass ] - tokenKey [ - - ^self preferenceAt: #tokenKey ifAbsentPut: ['_token'] - ] - addSession: aSession [ self sessions at: aSession id asString put: aSession @@ -153,17 +153,11 @@ To remove all expired sessions, call #removeExpiredSessions'> ^self findSessionWithId: (self sessionIdFromRequest: aRequest) ] - removeSession: aSession [ - - aSession removeYourself - ] - shouldRemoveExpiredSessions [ - "Do not remove all expired sessions for each request, - so only answer true if sessions size modulo 10 equals 0" + "Do not remove all expired sessions for each request" - ^(self sessions size \\ 10) = 0 + ^(Random new next * 10) asInteger = 0 ] findSessionWithId: anId [ @@ -190,11 +184,17 @@ To remove all expired sessions, call #removeExpiredSessions'> ^session ] + removeSession: aSession [ + + self sessions + removeKey: aSession id asString + ifAbsent: [] + ] + removeAllSessions [ "Remove all sessions. Use for maintenance" - self sessions values do: [:each | self removeSession: each]. sessions := Dictionary new ]