Getting a list of active sessions - Printable Version +- Atozed Forums (https://www.atozed.com/forums) +-- Forum: Atozed Software Products (https://www.atozed.com/forums/forum-1.html) +--- Forum: IntraWeb (https://www.atozed.com/forums/forum-3.html) +---- Forum: English (https://www.atozed.com/forums/forum-16.html) +----- Forum: IntraWeb General Discussion (https://www.atozed.com/forums/forum-4.html) +----- Thread: Getting a list of active sessions (/thread-99.html) |
Getting a list of active sessions - mhammady - 04-15-2018 Hello Is is possible to get a list of active sessions? The reason for my question is that i found that there are orphaned files related to expired sessions that was not deleted, and i want to create a periodic clean-up process to delete files not related to active sessions. PS: My files are stored in application directory with the session ID name. Mohamed RE: Getting a list of active sessions - DanBarclay - 04-15-2018 (04-15-2018, 11:04 PM)mhammady Wrote: Hello You can try something like the following to get a list of sessions. I found this code, or something similar, online some time back. Some of the locks may be redundant. Code: function ListOfSessionHandles:string; That said, it only gives you a list of active sessions. You'd have to keep up with all sessions in order to find your targets. Another approach is to "clean up" entirely on some basis. You can drop an entire subdirectory on server shutdown (and add it on startup if necessary). You might also consider killing the subdirectory if you routinely get down to zero sessions. Dan RE: Getting a list of active sessions - mhammady - 04-16-2018 Thank you Dan. I shall give it a try... Mohamed RE: Getting a list of active sessions - Alexandre Machado - 02-27-2020 For future readers: In IW 15.1+ that's the new way of dealing with session list: https://github.com/Atozed/IntraWeb/tree/master/15/Delphi/SessionList https://github.com/Atozed/IntraWeb/tree/master/15/Delphi/SessionLookup151 The session list doesn't use any global lock anymore, so it is not possible nor required to "lock" it. RE: Getting a list of active sessions - DanBarclay - 02-28-2020 (02-27-2020, 10:07 PM)Alexandre Machado Wrote: For future readers:Yes! And for those who see this and initially react that it might be a problem to migrate, it isn't. Trivial change, see the demos Alex linked. Dan |