[hunchentoot-devel] using SESSION-VALUE without START-SESSION will never call HT::COUNT-SESSION-USAGE

hi, seems using HT:SESSION-VALUE without ever calling HT:START-SESSION never calls HT::COUNT-SESSION-USAGE CL-USER> (sb-introspect:who-calls 'ht::count-session-usage) ((HUNCHENTOOT:START-SESSION . #S(SB-INTROSPECT:DEFINITION-SOURCE :PATHNAME #P"/home/lars/programming/lisp/hunchentoot/session.lisp" :FORM-PATH (12 4) :CHARACTER-OFFSET 7759 :FILE-WRITE-DATE 3415636264 :PLIST NIL :DESCRIPTION NIL))) CL-USER> (sb-introspect:who-calls 'ht:start-session) NIL so the only thing that calls HT::COUNT-SESSION-USAGE is HT:SESSION-START, and nothing calls HT:SESSION-START .. (hope i got this right; i'm tired) from the documentation (which is great btw.) I assumed "(counting only requests which use sessions)" included cases where I used SESSION-VALUE since, well, i "use" sessions then ... :) http://www.weitz.de/hunchentoot/#*session-gc-frequency* -- Lars Rune Nøstdal http://nostdal.org/

Lars Rune Nøstdal <larsnostdal <at> gmail.com> writes:
so the only thing that calls HT::COUNT-SESSION-USAGE is HT:SESSION-START, and nothing calls HT:SESSION-START .. (hope i got this right; i'm tired)
actually .. it seems (SETF SESSION-VALUE) does call HT:SESSION-START ..but i still expected different behavior based on: "A session garbage collection (see SESSION-GC) will happen every *SESSION-GC-FREQUENCY* requests (counting only requests which use sessions) if the value of this variable is not NIL. It's default value is 50. " ..which led me to think this also included cases where SESSION-VALUE where called ("requests which use sessions") ..i'm working on a chat toy (ajax and comet-polling will lead to 50 requests pretty fast).. and i needed to have sessions timeout when users leave the "chat-page" or get disconnected so i can update the nick-list close to real time -- Lars Rune Nøstdal http://nostdal.org/

Lars Rune Nøstdal <larsnostdal <at> gmail.com> writes:
"A session garbage collection (see SESSION-GC) will happen every *SESSION-GC-FREQUENCY* requests (counting only requests which use sessions) if the value of this variable is not NIL. It's default value is 50. "
maybe it should be "counting only requests which start a new session"? -- Lars Rune Nøstdal http://nostdal.org/

On Sat, 29 Mar 2008 23:55:53 +0000 (UTC), Lars Rune Nøstdal <larsnostdal@gmail.com> wrote:
from the documentation (which is great btw.) I assumed "(counting only requests which use sessions)" included cases where I used SESSION-VALUE since, well, i "use" sessions then ... :)
Well, kind of. The documentation says that sessions have to be started explicitly with START-SESSION or implictly with (SETF SESSION-VALUE). One could argue that pages which use neither of these operations don't really /use/ sessions as you can't be sure that you're in a session in that case. Anyway, what is the actualy problem you're trying to solve? The current situation is that there's only a check for a session GC if a new session /might/ be created. One could even improve this by only checking for a session GC if a new session /is/ actually created. If your code actually relies on /counting/ something, you should probably implement your own counter for this, shouldn't you?
participants (2)
-
Edi Weitz
-
Lars Rune Nøstdal