Tim Badolato
01/13/2023, 7:10 PMif(isNull(session.user.id)) {
StructClear(session);
}
Though doing this doesn't seem to end the session. Is this the official way or is there another way in Lucee to officially destroy the session in a way that FusionReactor would recognize?bdw429s
01/13/2023, 7:18 PMsessionInvalidate() to remove itAdam Cameron
sessionInvalidate might help you - https://helpx.adobe.com/coldfusion/cfml-reference/coldfusion-functions/functions-s/sessioninvalidate.html - but there are some caveats as mentioned in the docs.
I think on the whole keep yer session timeout short, and on any docs that the user might naturally idle on for a long time, ping back to the server periodically to keep their session alive. Or just let it timeout and have them reauthenticate and take them back to the same URL afterwards.
Don't forget the sessiontimeout resets every request. Often ppl don't need as long a session timeout as they might thinkbdw429s
01/13/2023, 7:19 PMAdam Cameron
bdw429s
01/13/2023, 7:20 PMTim Badolato
01/13/2023, 7:22 PMTim Badolato
01/13/2023, 7:23 PMAdam Cameron
applicationStop instead of calling onApplicationStart, thinking that has anything to do with restarting the application. Another thing that ppl often get confused about.bdw429s
01/13/2023, 7:23 PMWouldn't this require constantly hitting the DB?Not necessarily. It depends on whether you set
sessionCluster to true or false šbdw429s
01/13/2023, 7:24 PMAdam Cameron
Tim Badolato
01/13/2023, 8:02 PMsessionInvalidate in production but I'm still not seeing any destroyed sessions. š¤Adam Cameron
onSessionEnd so as to gauge how many destroyed sessions you'd be expecting to see?Tim Badolato
01/13/2023, 8:10 PMsessionInvalidate doesn't seem to be triggering onSessionEndTim Badolato
01/13/2023, 8:10 PMbdw429s
01/13/2023, 8:29 PMTim Badolato
01/13/2023, 8:30 PMbdw429s
01/13/2023, 8:30 PMbdw429s
01/13/2023, 8:30 PMbdw429s
01/13/2023, 8:31 PMAdam Cameron
sessionInvalidate doesn't work. It... erm... does... on CF.
Sorry for the bum steer there Tim.Tim Badolato
01/13/2023, 8:37 PMbdw429s
01/13/2023, 8:44 PMthis.sessionTimeout=0;
in Application.cfc OR
application action="update" sessionTimeout=0;
anywhere in your code. (which despite its appearance, will only affect the current request) And like Zac said in the channel, Lucee clears dead scopes async after a minute or so.Adam Cameron
sessiontimeout to 0 has odd behaviour on Lucee.
I'm passing a URL param sessionTimeoutSeconds which I use thus:
this.sessionTimeout = createTimespan(0, 0, 0, URL.sessionTimeoutSeconds)
I then make a request with that as default, then one with that 0, and then a third with default.
The first req starts a session. The third req starts a new session, and onSessionEnd is only ever called for that second session (identifying different sessions via sessionId).
The session end doesn't seem to respect the timeout. I've run it a coupla times, and it seems to be called "within a minute" of when it was supposed to run.Adam Cameron
sessiontimeout being set to zero. It seems to kill the session, but not start a new one before running onRequestStart :-S )Adam Cameron
Element SESSIONID is undefined in SESSION. in onRequestStart for the req setting the timeout to 0. Unless 0 means "disable sessions"? Which... erm... is not the same as setting the timeout to zero, but hey... is this at all surprising?Adam Cameron
onSessionEnd. Not as good as it could be, but... I can see why.bdw429s
01/13/2023, 8:58 PMAdam Cameron
bdw429s
01/13/2023, 8:59 PMonSessionEnd() method later since that happens outside of any web contextAdam Cameron
Adam Cameron
bdw429s
01/13/2023, 9:00 PMAdam Cameron
Adam Cameron
Lucee stores the actual Application.cfc instanceIs that in case the handler needs any app settings or anything? Does seem... egregious.
Adam Cameron
bdw429s
01/13/2023, 9:05 PMbdw429s
01/13/2023, 9:06 PMbdw429s
01/13/2023, 9:06 PMAdam Cameron
Adam Cameron
bdw429s
01/13/2023, 9:07 PMAdam Cameron
onRequest then that could be a fuck-load of variables?bdw429s
01/13/2023, 9:07 PMbdw429s
01/13/2023, 9:08 PMAdam Cameron
Adam Cameron
Adam Cameron
Adam Cameron
bdw429s
01/13/2023, 9:09 PMAdam Cameron
Dave Merrill
01/13/2023, 10:06 PMAdam Cameron
sessionInvalidate.Adam Cameron
Adam Cameron
sessionTimeout is here:
https://github.com/adamcameron/cfml/tree/session_ivalidate/cfmlLanguage/scopes/session/invalidateAdam Cameron
sessionInvalidate stuff, uncomment it from invalidate.cfmAnders Lars
01/14/2023, 4:05 AMif ( (variables.browserInfo.isBot) &&! variables.sentCookie ) {this.sessionTimeout = createTimespan(0,0,0,5);Anders Lars
01/14/2023, 4:09 AM