Auto-start a new session from ServerController - 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: Auto-start a new session from ServerController (/thread-3273.html) |
Auto-start a new session from ServerController - zsleo - 06-01-2023 I want to auto-start a new session from ServerController that does not have a user interface. Is there a better way of starting the session other than by calling the URL with the required parameters? TIA RE: Auto-start a new session from ServerController - Alexandre Machado - 06-02-2023 Do you really need to create a session or just to do some background task once or regularly? RE: Auto-start a new session from ServerController - zsleo - 06-03-2023 (06-02-2023, 11:09 PM)Alexandre Machado Wrote: Do you really need to create a session or just to do some background task once or regularly? It is multiple background tasks regulary RE: Auto-start a new session from ServerController - Alexandre Machado - 06-03-2023 Ideally you should create a background thread and run these tasks from it. If they can run sequentially, it's even better. You can use our TIWTimedThread class that will handle this nicely: Code: uses TIWTimedThread will call the DoExecute method at regular intervals, which is specified when you create the thread. I recommend you to put the code of the thread in a separate unit. Also, when working with threads: If you need any database connectivity from within the thread, create an exclusive connection in the thread itself, don't try to "share" an external connection. I'll see if I can publish a demo showing an usage example like this. Cheers RE: Auto-start a new session from ServerController - zsleo - 06-03-2023 (06-03-2023, 08:28 PM)Alexandre Machado Wrote: Ideally you should create a background thread and run these tasks from it. If they can run sequentially, it's even better.Thanks Alexandre, Much appreciated RE: Auto-start a new session from ServerController - Alexandre Machado - 06-04-2023 I've just published a new demo showing how to do it: https://github.com/Atozed/IntraWeb/tree/master/15/Delphi/TaskInThread RE: Auto-start a new session from ServerController - zsleo - 06-05-2023 Thank you Alexandre. Much appreciated |